Skip to content

Only dispatch standard HTTP verbs in HTTPEndpoint#3286

Merged
Kludex merged 4 commits into
mainfrom
restrict-httpendpoint-dispatch-to-standard-verbs
May 23, 2026
Merged

Only dispatch standard HTTP verbs in HTTPEndpoint#3286
Kludex merged 4 commits into
mainfrom
restrict-httpendpoint-dispatch-to-standard-verbs

Conversation

@Kludex
Copy link
Copy Markdown
Owner

@Kludex Kludex commented May 23, 2026

Summary

HTTPEndpoint.dispatch() resolved the request handler by looking up the lowercased request method as an attribute via getattr(). This means the method name selects which instance attribute is called, with no restriction to actual HTTP verbs.

This narrows dispatch to the canonical verb set (GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS) - the same set already used to compute _allowed_methods and the Allow header. Any other method now returns 405 Method Not Allowed, consistent with how unsupported standard verbs are already handled. The HEAD -> GET fallback is preserved.

Test

Added a regression test covering a non-standard method, verified to fail before the change and pass after.

AI Disclaimer

This PR was developed with the assistance of either Claude or Codex. I've reviewed and verified the changes.

Kludex added 4 commits May 23, 2026 10:38
HTTPEndpoint.dispatch() resolved the handler by looking up the lowercased
request method as an attribute. Restrict dispatch to the canonical HTTP
verb set, returning a 405 for anything else.
@Kludex Kludex changed the title Only dispatch standard HTTP verbs in HTTPEndpoint Only dispatch standard HTTP verbs in HTTPEndpoint May 23, 2026
@Kludex Kludex merged commit e3f9722 into main May 23, 2026
12 of 17 checks passed
@Kludex Kludex deleted the restrict-httpendpoint-dispatch-to-standard-verbs branch May 23, 2026 15:43
@Kludex Kludex mentioned this pull request May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant