Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebClient.mutate() impacts future .mutate() invocations [SPR-16059] #20608

Closed
spring-issuemaster opened this issue Oct 10, 2017 · 4 comments

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

commented Oct 10, 2017

Rob Winch opened SPR-16059 and commented

The following code is surprising to me in that by the end it has 10 ExchangeFilterFunction instances on the WebClient which means the request contains the headers header0..header9.

WebClient client = WebClient.create();
for(int i = 0; i<10; i++) {
	String headerName = "header" + i;
	String size = client
			.mutate()
			.filter((request, next) -> {
				request = ClientRequest.from(request)
						.header(headerName, "addative")
						.build();
				return next.exchange(request);
			})
			.build()
			.get()
			.uri("http://localhost:8080/foo")
			.retrieve()
			.bodyToMono(String.class)
			.block();
}

Instead each request should only have a single headerX value in it.
WebTestClient has the same problem. I'm not sure if it is the same issue, but it should be fixed too.


Affects: 5.0 GA

Referenced from: commits 24ca8cc, faa7498

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Oct 13, 2017

Arjen Poutsma commented

And that bug is now fixed.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Oct 13, 2017

Rob Winch commented

Arjen Poutsma Thanks for the fast fix!

The changes do fix the problem with WebClient, but it appears that WebTestClient is still broken. Perhaps the fact that WebTestClient was also impacted was just missed given I buried it at the very end of the report? Should I log a separate issue for WebTestClient or can we just reuse this issue?

Thanks again!

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Oct 13, 2017

Arjen Poutsma commented

Whoops, sorry, I missed that. That one should be fixed now as well.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Oct 13, 2017

Rob Winch commented

Thanks! I can confirm that fixed both places.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.