Opened 8 years ago

Last modified 6 years ago

#4636 new defect

API User Details returns 404 instead of 405

Reported by: andrew@… Owned by: rails-dev@…
Priority: minor Milestone: OSM 0.6
Component: api Version:
Keywords: Cc:


When is accessed using the POST method instead of GET, it returns a 404 error instead of a 405.

Reproducible by using and selecting the POST method and entering the above URL.

Change History (4)

comment:1 Changed 8 years ago by Tom Hughes

This is a "feature" of rails where if you have routes that are qualified by what methods they accept (as all ours are) then when they fail to match they are ignored and you eventually get a 404 because no route matched.

There isn't really anything we can (easily) do about this I'm afraid.

comment:2 Changed 8 years ago by andrew@…

I don't know anything about rails (apart from what I've read in the last five minutes), but then it sounds as though you'd have to add routes for all the methods you don't support and send them to a 405 response? Or is there a default route you could add after all the explicit methods have been matched?

comment:3 Changed 8 years ago by Tom Hughes

Well you can't have a default route that returns 405 because then it would do so for URLs which really don't exist.

You would have to duplicate each URL with a second "match all" version that returned 405 and that is just not scalable.

This should really be fixed in rails' URL matcher so that it remembers if the URL would have matched except for the method qualification and then returns 405 in that case.

comment:4 Changed 6 years ago by don-vip

Milestone: OSM 0.6
Note: See TracTickets for help on using tickets.