Closed joubertredrat closed 3 years ago
I don't think that we will define routes for all situations, so if there is no route defined a 404 response should be fine
@tboerger yes, for now is working, but we need to consider to fix this on future because is a bug about API design.
Look how my API response this.
{"code":405,"message":"Method Not Allowed"}
IMO we should just return
< HTTP/1.1 405 Method Not Allowed
< Content-Length: 70
< Content-Type: application/json; charset=utf-8
< Date: Mon, 26 Dec 2016 18:53:53 GMT
< Set-Cookie: lang=en-US; Path=/; Max-Age=2147483647
< Set-Cookie: i_like_gitea=my-hidden-cookie; Path=/; HttpOnly
< Set-Cookie: _csrf=hidden-too; Path=/; Expires=Tue, 27 Dec 2016 18:53:53 GMT; HttpOnly
< X-Frame-Options: SAMEORIGIN
Method Not Allowed
No need for json there :)
Any PR for this issue?
@lunny issue is in macaron, not Gitea 🙁 And I think that most routers have this issue...
So we need to submit an issue to macaron?
Yes
[x]
):Description
Hi guys, I'm testing API calls and I found one error, as example below
GET v1/user/repos
Get username repositories. But If I try with other method, the HTTP response is415
or404
as below:The correct HTTP response in this case is
405 Method not allowed
, as describle here, https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.6