Brian Clozel opened SPR-17502 and commented
Given the following controller in Spring WebFlux:
@RestController
public class TestController {
@GetMapping(path = "/", produces = MediaType.TEXT_PLAIN_VALUE)
public Flux<String> text(ServerWebExchange exchange) {
exchange.getResponse().getHeaders().setContentLength(12);
return Flux.error(new IllegalStateException());
}
}
When this handler is used, the thrown exception is being handled by the WebExceptionHandlers configured instances. At that point, the response might be committed or not.
When used in Spring Boot, this will cause HTTP clients to partially read the actual error response (JSON or HTML), since those are written in chunked encoding mode. Also, other encoders will opt out and won't override any existing "Content-Length" header.
We should (in ExceptionHandlingWebHandler ?) make sure that we try and remove the "Content-Length" response header as the error response won't be of the same length.
Affects: 5.0.10, 5.1.2
Referenced from: commits 617b94a, 3203d39, 5342c6e
Backported to: 5.0.11
1 votes, 4 watchers
Brian Clozel opened SPR-17502 and commented
Given the following controller in Spring WebFlux:
When this handler is used, the thrown exception is being handled by the
WebExceptionHandlersconfigured instances. At that point, the response might be committed or not.When used in Spring Boot, this will cause HTTP clients to partially read the actual error response (JSON or HTML), since those are written in chunked encoding mode. Also, other encoders will opt out and won't override any existing
"Content-Length"header.We should (in
ExceptionHandlingWebHandler?) make sure that we try and remove the"Content-Length"response header as the error response won't be of the same length.Affects: 5.0.10, 5.1.2
Referenced from: commits 617b94a, 3203d39, 5342c6e
Backported to: 5.0.11
1 votes, 4 watchers