Open timyates opened 2 weeks ago
Prior to Micronaut 4, the following returned a 307 response
MutableHttpResponse createResponse() { final override = Map.of( 'Location', 'http://foo.com', 'Content-Length', '0', 'Connection', 'close' ) return HttpResponse .status(HttpStatus.valueOf(307)) .headers(toMutableHeaders(override)) } @Get("/redirect/fail") CompletableFuture<MutableHttpResponse> redirectFail() { CompletableFuture.completedFuture(createResponse()) }
Instead of the expected 307 response, we get a 200 response.
If we add a body to the response by changing the above example to the following, we get 307 as expected
return HttpResponse .status(HttpStatus.valueOf(307)) .body('') .headers(toMutableHeaders(override))
I suspect the issue is here as supplying a body to the response object makes it return the correct status code.
I guess any custom headers are also currently being dropped 🤔
The reproducer is in Groovy, but I don't think it's a Groovy issue 🤔
Clone https://github.com/munishchouhan/temporaryredirectproblem Run the tests
No response
https://github.com/munishchouhan/temporaryredirectproblem
4.5.0
Expected Behavior
Prior to Micronaut 4, the following returned a 307 response
Actual Behaviour
Instead of the expected 307 response, we get a 200 response.
If we add a body to the response by changing the above example to the following, we get 307 as expected
I suspect the issue is here as supplying a body to the response object makes it return the correct status code.
I guess any custom headers are also currently being dropped 🤔
The reproducer is in Groovy, but I don't think it's a Groovy issue 🤔
Steps To Reproduce
Clone https://github.com/munishchouhan/temporaryredirectproblem Run the tests
Environment Information
No response
Example Application
https://github.com/munishchouhan/temporaryredirectproblem
Version
4.5.0