diff --git a/httpclient/src/main/java/org/apache/http/client/protocol/RequestDefaultHeaders.java b/httpclient/src/main/java/org/apache/http/client/protocol/RequestDefaultHeaders.java index b7792679f..372c46bae 100644 --- a/httpclient/src/main/java/org/apache/http/client/protocol/RequestDefaultHeaders.java +++ b/httpclient/src/main/java/org/apache/http/client/protocol/RequestDefaultHeaders.java @@ -67,11 +67,13 @@ public class RequestDefaultHeaders implements HttpRequestInterceptor { } // Add default headers - Collection defHeaders = (Collection) request.getParams().getParameter( + @SuppressWarnings("unchecked") + Collection
defHeaders = (Collection
) request.getParams().getParameter( ClientPNames.DEFAULT_HEADERS); + if (defHeaders != null) { - for (Object defHeader : defHeaders) { - request.addHeader((Header) defHeader); + for (Header defHeader : defHeaders) { + request.addHeader(defHeader); } } }