Using Invalid Method Should Return 405
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 259
- Forks
- 168
- Avg merge
- 6h 15m
- Merged PRs (30d)
- 1
Description
When accessing some endpoints, it appears that only GET, OPTIONS and HEAD are appropriate HTTP Request Methods. If an invalid HTTP Request Method is used, the response is coded as 404 Not Found, but should be 405 Method Not Allowed.
To Reproduce:
- Send a GET to
/search/structured?locality=foo(200 OKreturned) - Send a POST to that same URL.
Expected Response:
Server should respond with a 405 Method Not Allowed, with an appropriate message in the response body.
Actual Response:
404 Not Found
{
"error": "not found: invalid path"
}
Additional Information:
Endpoints I've seen with this behavior:
- /
- /search (a POST actually returns a
200 OKhere) - /autocomplete
- /search/structured
- /place
- /reverse
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the GET and POST requests for /search/structured?locality=foo, then inspect the request handling for the listed endpoints: /, /search, /autocomplete, /search/structured, /place, and /reverse. Done means unsupported methods return 405 Method Not Allowed with an appropriate response body instead of 404, while supported methods continue to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100