[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-2265?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Oleg Kalnichevski resolved HTTPCLIENT-2265.
-------------------------------------------
    Resolution: Information Provided

> Need advice on accessing Entity
> -------------------------------
>
>                 Key: HTTPCLIENT-2265
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2265
>             Project: HttpComponents HttpClient
>          Issue Type: Task
>            Reporter: Patrick Barry
>            Priority: Trivial
>
> I am currently testing with a 'production configured client' and am trying to 
> see the entity of outbound request and inbound response.  I created a 
> UnitTestExecutionContext to help me capture requests/responses and since 
> there can be multiple due to retries, I capture a list of them.  All of this 
> is working well, and I have access to EntityDetails, Headers, URL, Response 
> codes, etc, however, I cannot seem to figure out how to capture the entities. 
> Can you point me to code or advice me on how I might accomplish this?  I have 
> been hacking things together using ExecInterceptorLast, wrapping the 
> entityProducer and some other crazy things.  Hoping someone can point me in 
> right direction.
>  
> {code:java}
> public class UnitTestExecutionContext extends ExecutionContext {
>     List<HttpCapture<HttpResponse>> httpResponses = new ArrayList<>();
>     List<HttpCapture<HttpRequest>> httpRequests = new ArrayList<>();
> } {code}
> snippet of how I am appending some interceptors onto to some previous 
> configurations used in production.
> {code:java}
> HttpAsyncClientBuilder builder = super.asyncClientBuilder(ioReactorConfig, 
> connectionManager, dynamicRequestInterceptor);
> builder.addRequestInterceptorLast((httpRequest, entityDetails, httpContext) 
> -> ((UnitTestExecutionContext)httpContext).addHttpRequest(httpRequest, 
> entityDetails));
> builder.addResponseInterceptorFirst((httpResponse, entityDetails, 
> httpContext) -> 
> ((UnitTestExecutionContext)httpContext).addHttpResponse(httpResponse, 
> entityDetails)); {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org

Reply via email to