Skip to content

HttpComponentsAsyncClientHttpRequestFactory overrides default request config of httpclient [SPR-13125] #17716

Closed
@spring-projects-issues

Description

@spring-projects-issues

Sylvain LAURENT opened SPR-13125 and commented

Same problem as #17144 but for HttpComponentsAsyncClientHttpRequestFactory : if I configure timeouts at the httpclient level but nothing in HttpComponentsAsyncClientHttpRequestFactory, then no timeout is applied.

In org.springframework.http.client.HttpComponentsAsyncClientHttpRequestFactory.createAsyncRequest(URI, HttpMethod) one can see that RequestConfig.DEFAULT is set instead of leaving it as nul :

if (context.getAttribute(HttpClientContext.REQUEST_CONFIG) == null) {
    // Use request configuration given by the user, when available
    RequestConfig config = null;
    if (httpRequest instanceof Configurable) {
        config = ((Configurable) httpRequest).getConfig();
    }
    if (config == null) {
        config = RequestConfig.DEFAULT;
    }
    context.setAttribute(HttpClientContext.REQUEST_CONFIG, config);
}

Affects: 4.1.6

Issue Links:

Referenced from: commits 0434890, 5236eb6

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions