Skip to content

Provide simple way to create ClientResponse [SPR-16553] #21096

@spring-projects-issues

Description

@spring-projects-issues

Rob Winch opened SPR-16553 and commented

When working with an ExchangeFilterFunction it expects that a Mono<ClientResponse> is provided as a return type. Similar to ClientRequest.Builder for ClientRequest, it would be nice if there were a simple way to create a ClientResponse. This would make it easier to use the ExchangeFilterFunction API to provide custom ClientResponse. For example, consider an ExchangeFilterFunction that provides a default value on an error:

ClientResponse fallbackResponse = null; // no builder for this
ExchangeFilterFunction fallback = (r,n) -> n
		.exchange(r)
		.onErrorResume(Exception.class, e -> Mono.just(fallbackResponse));

A few use cases that would be valuable to support are:

  • Creating a ClientResponse from a WebClient.ResponseSpec
  • Creating a ClientResponse from an existing ClientResponse

Affects: 5.0.4

Issue Links:

Referenced from: commits 04c2a29

0 votes, 5 watchers

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