Agent Wranglers

Resources and methods Recommended

Return 405 with the allowed methods

When a path exists but the method doesn't apply, answer 405 and list what works in the Allow header.

How to do it

RFC 9110 requires the Allow header on a 405. Let the router produce it from the routes it knows, so it stays correct.

How to check

curl -i -X DELETE https://api.example.com/orders returns 405 with Allow: GET, POST.

For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers api design playbook: https://agentwranglers.se/playbook/api-design/resources-and-methods/method-not-allowed.