Set Allow header to "GET" for 405 responses in `StaticFileHandler' - #111
Conversation
… update test coverage
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
fredrikmohlen
left a comment
There was a problem hiding this comment.
You have addressed the issue by adding the Allow: GET header to the response. You have also updated the corresponding tests to reflect and verify this change.
d7a5dab
into
103-add-request-handler-last-in-filterchain
#107) * Refactor StaticFileHandler and test suite to use HttpRequest and HttpResponseBuilder. * Refactor test cases to use HttpResponseBuilder assertions and enhance URI normalization in StaticFileHandler. * Add support for 405 responses to non-GET methods in StaticFileHandler and tests. * Set `Allow` header to "GET" for 405 responses in `StaticFileHandler`, update test coverage (#111) * Comprehensive Unit Tests for FilterChainImpl after implemented TerminalHandler (#113) * Add unit test for `FilterChainImpl` to verify terminal handler invocation without filters * Test confirms that chain.doFilter() correctly triggers the next filter in sequence and terminates at the handler. * Test ensures TerminalHandler is bypassed when a filter blocks the chain --------- Co-authored-by: Caroline Nordbrandt <caroline_nordbradt@hotmail.com>
Summary
Add
Allow: GETto 405 (Method Not Allowed) responses for non-GET requests.Why
When returning HTTP 405, the server should indicate which methods are allowed. This makes the response more HTTP-compliant and clearer for clients.
Changes
Allow: GETheader when rejecting non-GET requests with 405.Allowheader is present and correct.Testing
Allow: GET.Example, I checked this in Insomnia.