[
https://issues.apache.org/jira/browse/TIKA-4247?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17842134#comment-17842134
]
ASF GitHub Bot commented on TIKA-4247:
--------------------------------------
nddipiazza commented on code in PR #1737:
URL: https://github.com/apache/tika/pull/1737#discussion_r1583602257
##########
tika-pipes/tika-fetchers/tika-fetcher-http/src/main/java/org/apache/tika/pipes/fetcher/http/HttpFetcher.java:
##########
@@ -143,10 +143,24 @@ public InputStream fetch(String fetchKey, Metadata
metadata) throws IOException,
.setMaxRedirects(maxRedirects)
.setRedirectsEnabled(true).build();
get.setConfig(requestConfig);
- if (! StringUtils.isBlank(userAgent)) {
+ setHttpRequestHeaders(metadata, get);
+ return execute(get, metadata, httpClient, true);
+ }
+
+ private void setHttpRequestHeaders(Metadata metadata, HttpGet get) {
+ if (!StringUtils.isBlank(userAgent)) {
get.setHeader(USER_AGENT, userAgent);
}
- return execute(get, metadata, httpClient, true);
+ // additional http request headers can be sent in here.
+ String[] httpRequestHeaders = metadata.getValues("httpRequestHeaders");
Review Comment:
httpHeaders is a config parameter that is for storing some of the http
headers on the response. I will look into documenting the jsons somehow to
prevent confusion in future.
> HttpFetcher - add ability to send request headers
> -------------------------------------------------
>
> Key: TIKA-4247
> URL: https://issues.apache.org/jira/browse/TIKA-4247
> Project: Tika
> Issue Type: New Feature
> Reporter: Nicholas DiPiazza
> Priority: Major
>
> add ability to send request headers
--
This message was sent by Atlassian Jira
(v8.20.10#820010)