elysiajs / elysia

Ergonomic Framework for Humans
https://elysiajs.com
MIT License
9.09k stars 193 forks source link

Return 405 error for wrong method on a resource, rather than 404 #682

Open Nmans01 opened 3 weeks ago

Nmans01 commented 3 weeks ago

What is the problem this feature would solve?

This spec indicates that requests using the wrong method for a resource should return a 405 Method Not Allowed error with an Allow header to direct clients to use the proper method. Currently Elysia only returns a 404 response.

What is the feature you are proposing to solve the problem?

Elysia can follow spec, returning the 405 error code and possibly using server state to get allowed methods and format the Allow header.

What alternatives have you considered?

No response