rest-assured/src/main/java/io/restassured/config/HeaderConfig.java
public HeaderConfig overwriteHeadersWithName(String headerName, String... additionalHeaderNames) {
        notNull(headerName, "Header name");
        Map<String, Boolean> map = newHashMapReturningFalseByDefault(headerName);
        if (additionalHeaderNames != null && additionalHeaderNames.length > 0) {
            for (String additionalHeaderName : additionalHeaderNames) {
                map.put(additionalHeaderName.toUpperCase(), true);
            }
        }
        return new HeaderConfig(map, true);
    }
public HeaderConfig overwriteHeadersWithName(String headerName, String... additionalHeaderNames) {
        notNull(headerName, "Header name");
        Map<String, Boolean> map = newHashMapReturningFalseByDefault(headerName);
        if (additionalHeaderNames != null && additionalHeaderNames.length > 0) {
            for (String additionalHeaderName : additionalHeaderNames) {
                map.put(additionalHeaderName.toUpperCase(), true);
            }
        }
        return new HeaderConfig(map, true);
    }
Define headers that should be overwritten instead of merged adding headers or using request specifications. Note that
by default all headers are merged except the {@value #ACCEPT_HEADER_NAME} and {@value #CONTENT_TYPE_HEADER_NAME} headers.
For example, if the header with name <code>header1</code> is <i>not</i> marked as overwritable (default) and you do the following:
<pre>
given().header("header1", "value1").header("header1, "value2"). ..
</pre>
<p/>
Then <code>header1</code> will be sent twice in the request:
<pre>
header1: value1
header1: value2
</pre>
<p/>
If you configure <code>header1</code> to be overwritable by doing:
<pre>
given().
config(RestAssured.config().headerConfig(headerConfig().overwriteHeadersWithName("header1")).
header("header1", "value1").
header("header1", "value2").
...
</pre>
then <code>header1</code> will only be sent once:
<pre>
header1: value2
</pre>

@param headerName            The header name to overwrite.
@param additionalHeaderNames Additional header names to overwrite (optional).
@return A new instance of {@link HeaderConfig}.