Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
5.0
-
None
Description
With the following:
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"));
Result:
This should be last This should be first
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.
if (entry.postion == RequestInterceptorEntry.Postion.LAST) {
b.addFirst(entry.interceptor);
}
This should probably be the following:
if (entry.postion == RequestInterceptorEntry.Postion.LAST) {
b.addLast(entry.interceptor);
}