Skip to content

Fix addResponseHeader failing on built-in filter and handler response - #4331

Open
JoeCqupt wants to merge 1 commit into
spring-cloud:mainfrom
JoeCqupt:fix/fix-4168
Open

JoeCqupt wants to merge 1 commit into
spring-cloud:mainfrom
JoeCqupt:fix/fix-4168

Conversation

@JoeCqupt

Copy link
Copy Markdown
Contributor

While looking into #4168, I found that several built-in filters and handlers in the WebMvc server return a plain ServerResponse (e.g. ServerResponse.ok().build()). ServerResponse makes the headers read-only, so any after filter that modifies response headers, such as addResponseHeader fails with UnsupportedOperationException.

Built-in filters and handlers (redirectTo, rateLimit, circuitBreaker, fn, stream) returned ServerResponse instances with read-only headers, so after filters such as addResponseHeader threw UnsupportedOperationException. Return GatewayServerResponse instead so response headers stay mutable.

…sponses

Built-in filters and handlers (redirectTo, rateLimit, circuitBreaker, fn, stream) returned ServerResponse instances with read-only headers, so after filters such as addResponseHeader threw UnsupportedOperationException. Return GatewayServerResponse instead so response headers stay mutable.

Fixes spring-cloudgh-4168

Signed-off-by: JoeCqupt <joe469391363@gmail.com>
@JoeCqupt

Copy link
Copy Markdown
Contributor Author

@ryanjbaxter PTAL

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants