Skip to content

Improve adding defaults to WebClient requests [SPR-15208] #19772

@spring-projects-issues

Description

@spring-projects-issues

Rob Winch opened SPR-15208 and commented

It would be nice if there was a more elegant way to provide defaults for a request. For example, it would be nice if we could easily change the accept to JSON. The following is pretty verbose:

WebClient webClient = WebClient.create("http://localhost:" + port)
        .filter((request, next) -> {
            ClientRequest<Void> json = ClientRequest
                    .from(request)
                    .header("Accept", MediaType.APPLICATION_JSON_VALUE)
                    .build();
            return next.exchange(json);
        });

No further details from SPR-15208

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