Skip to content

Improve efficiency of mutating of ClientHttpResponse and ServerHttpRequest  #24680

Closed
@rstoyanchev

Description

@rstoyanchev

DefaultClientResponse has from(ClientResponse) which copies status, headers, and cookies. It is only half as useful because it ignores the body which is easy to forget or otherwise leads to code like this as a starting point:

ClientResponse.from(response).body(response.bodyToFlux(DataBuffer.class)

We should add ClientResponse.mutate() matching to similar options on the server side. Also both client and server mutate() should be careful not to parse cookies unnecessarily which can lead to surprises, see #24663.

In addition since mutation can be quite common, it should be made as optimal as possible, avoiding object creation in parts not mutated, and also optimizing for repeated use, e.g. response headers).

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