public void setAdditionalHeaders(Map<String,String> additionalHeaders) {
        
        Map<String, String> newMap = new HashMap<>();
        for (Entry<String,String> e : additionalHeaders.entrySet()) {
            boolean found = false;
            for(String restrictedHeaderField : RESTRICTED_HTTP_HEADERS) {
                if (e.getKey().equalsIgnoreCase(restrictedHeaderField)) {
                    found = true;
                    break;
                }
            }
            if (!found) {
                newMap.put(e.getKey(), e.getValue());
            }
        }
        this.additionalHeaders = newMap;
    }
public void setAdditionalHeaders ( Map < String , String > additionalHeaders ) { Map < String , String > newMap = new HashMap < > ( ) ; for ( Entry < String , String > e : additionalHeaders . entrySet ( ) ) { boolean found = false ; for ( String restrictedHeaderField : RESTRICTED_HTTP_HEADERS ) { if ( e . getKey ( ) . equalsIgnoreCase ( restrictedHeaderField ) ) { found = true ; break ; } } if ( ! found ) { newMap . put ( e . getKey ( ) , e . getValue ( ) ) ; } } this . additionalHeaders = newMap ; }
Sets additional overall HTTP headers to add to the upload POST request. There's
rarely a need to use this method.

<p>The following header fields are automatically set:
<pre>
"Connection"
"Cache-Control"
"Content-Type"
"Content-Length"
"Authorization"
</pre> and you must <i>never</i> set these here. (if you do they will be
ignored)

<p>However you might want to use this method to
explicitly set e.g. {@code User-Agent} or non-standard header fields that
are required for your particular endpoint. For example by overriding
{@code User-Agent} you can make the upload operation look to the
endpoint as if it comes from a browser.

@param additionalHeaders Map of HTTP request headers. The key is the header field
name and the value is the header field value.