private MetadataMap<String, String> preparePostHeaderMap(Attachment att, HttpHeaders httpHeaders) {
        if (att == null && httpHeaders == null) {
            return null;
        }
        MetadataMap<String, String> finalHeaders = new MetadataMap<>(false, true);
        if (httpHeaders != null && httpHeaders.getRequestHeaders() != null) {
            finalHeaders.putAll(httpHeaders.getRequestHeaders());
        }
        if (att != null && att.getHeaders() != null) {
            finalHeaders.putAll(att.getHeaders());
        }
        return finalHeaders;
    }
Prepares a multivalued map, combining attachment headers and request headers.
Gives priority to attachment headers.

@param att         the attachment.
@param httpHeaders the http headers, fetched from context.
@return the case insensitive MetadataMap containing combined headers.
tika-server/tika-server-core/src/main/java/org/apache/tika/server/core/resource/TikaResource.java