-
Notifications
You must be signed in to change notification settings - Fork 38.4k
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
Handling of ResponseStatusException to also include setting of response headers #23741
Comments
It should be doing that: Line 259 in b7f819c
|
Thank you for the analysis, rstoyanchev.
Project files:
I create reactor.netty.http.server.HttpServer manually: HttpHandler handler = WebHttpHandlerBuilder.applicationContext(applicationContext).build();
DisposableServer server = reactor.netty.http.server.HttpServer.create()
.host(host).port(port)
.tcpConfiguration(tcpServer -> tcpServer.bootstrap(
serverBootstrap -> serverBootstrap.group(...).channel(NioServerSocketChannel.class)))
.handle(new ReactorHttpHandlerAdapter(handler))
.bind().block(); And I also have some REST controllers like: @org.springframework.web.bind.annotation.RestController
class MyRestController {
@RequestMapping(value = "/some-pattern", method = {RequestMethod.GET, RequestMethod.HEAD})
public Mono<Void> handler(ServerWebExchange exchange) {
return Mono.just(exchange).subscribeOn(scheduler).flatMap(exch-> handle(exch));
}
} And when I request
|
@rstoyanchev can I pick this up? If no one is working on it. seems good for a newbie. |
@antimpatel sure. Probably something in |
A ResponseStatus exception now exposes extra method to return headers for the response. This is used in ResponseStatusExceptionHandler to apply the headers to the response. Closes gh-23741
A ResponseStatus exception now exposes extra method to return headers for the response. This is used in ResponseStatusExceptionHandler to apply the headers to the response. Closes spring-projectsgh-23741
Affects: 5.1.10
Spring RestController offers a nice function, one could filter requests by methods. E.g.:
If a request matches the path pattern but does not match the method pattern spring-web automatically generates a response
405 Method Not Allowed
which is perfectly fine.But RFC 7231 Explicitly requires servers to include the Allow header (https://tools.ietf.org/html/rfc7231#page-59):
The origin server MUST generate an Allow header field in a 405 response containing a list of the target resource's currently supported methods.
It request method filters must automatically insert an Allow header with a list of allowed methods into a response.
The text was updated successfully, but these errors were encountered: