Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
ContextPathCompositeHandler returns 200 when no path found [SPR-17144] #21681
In scenarios where a call to a WebFlux application using ContextPathCompositeHandler do not match against a context path then the response can still be status code 200, rather than 404.
It looks like this is because the ContextPathCompositeHandler calls response.setComplete() but returns Mono.empty() when no handlers for a given path have been found.
This results in the callback chain for response.setComplete(), including the commit, and applyStatusCode() invocation to be discarded.
As a result, while the response status has been set to 404, this is not what gets written to outbound buffer.
This project: https://github.com/maubergine/cpch-bug-example illustrates the issue and the effect of updating the code (PR to be raised shortly).
Affects: 5.0.8, 5.1 RC1
Referenced from: pull request #1921