You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "John Enters (Jira)" <ji...@apache.org> on 2020/06/13 20:59:00 UTC
[jira] [Commented] (HTTPCLIENT-2084) HttpClientBuilder placing last
HttpRequestInterceptor first
[ https://issues.apache.org/jira/browse/HTTPCLIENT-2084?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17134954#comment-17134954 ]
John Enters commented on HTTPCLIENT-2084:
-----------------------------------------
The HttpResponseInterceptors may have the same problem on line 838
> HttpClientBuilder placing last HttpRequestInterceptor first
> -----------------------------------------------------------
>
> Key: HTTPCLIENT-2084
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2084
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Components: HttpClient (classic)
> Affects Versions: 5.0
> Reporter: John Enters
> Priority: Minor
> Fix For: 5.0.2
>
> Original Estimate: 20m
> Remaining Estimate: 20m
>
> With the following:
> {code:java}
> CloseableHttpClient client = HttpClients.custom()
> .addRequestInterceptorFirst((request, entity, context) -> {
> System.out.println("This should be first");
> })
> .addRequestInterceptorLast((request, entity, context) -> {
> System.out.println("This should be last");
> })
> .build();
> client.execute(new HttpGet("http://www.example.com"));
> {code}
> Result:
> {code:java}
> This should be last
> This should be first
> {code}
> In org.apache.hc.client5.http.impl.classic.HttpClientBuilder
> lines 830-832 adds the interceptor to the start of the list instead of the end.
> {code:java}
> if (entry.postion == RequestInterceptorEntry.Postion.LAST) {
> b.addFirst(entry.interceptor);
> }
> {code}
> This should probably be the following:
> {code:java}
> if (entry.postion == RequestInterceptorEntry.Postion.LAST) {
> b.addLast(entry.interceptor);
> }
> {code}
>
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org