Missing Http method returns 200 status code on api route
I am trying to generate API routes. In the docs I read that 405 is returned for non existing routes but when I create one let's say /api/logout and only define a DELETE method , if I call put on it it returns code 200 and html. Is this correct or have I missed something? Do I have to define all the methods I do not use and return 405 on them myself?
/api/logout.ts code below
12 Replies
we're gonna need more of the code dawg
I believe it is pretty straightforward I have only defined DELETE on this route -> when PUT is called it returns html and what i expected to happen is return 405.
ohhh
nevermind
I gotchu yeah lemme check
if you want something custom:
I haven't found anything in the docs that gives an alternative @silverdagger
yeah this is what I do atm -> create catch all routes and return 405 on all of them myself -> Just thought that maybe I missed something to "enable" this feature to do it for any undefined routes
wait
@silverdagger
in what folder are your endpoints?
routes/api/endpoint.ts
Have you wrapped anything in your Index file?
not sure what you mean
GitHub
solid-start/packages/start/fs-router/router.js at f351f42ba8566cbfa...
SolidStart, the Solid app framework. Contribute to solidjs/solid-start development by creating an account on GitHub.
Turns out it's not even in the code \o/
Ok strange... opened a PR. Should cover it. It's a bit more complicated than I thought. https://github.com/solidjs/solid-start/pull/1041
weird that it's in the docs, as if it's implemented