-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
requesting url that is not encoded correctly should return 400, not 404 #1264
Comments
I am not sure it is worth the effort... if you ask for an invalid path that will never match an existing route if we ignored the invalid path, 400 is appropriate. But not for cases where the route is both invalid and missing where 404 is the right response (since 400 implies a match). |
Or you could look it the other way around; GET /thing/1/priceRaise%/ (The actual route is /things...) First I get 400, saying something about encoding, so I encode it, fix the 400 and then get 404- I study the ap documentation and I see that the rout indeed does not exist. I'm not sure 400 implies a match, it states that it is a bad request that shouldn't be requested- anyhow, I'm trying to think about the people integrating with the api. What will make them more comfortable and integrate faster (with the api). I guess that if you get 404 you might eventually find the problem, but it might slow you down a bit- because the route will seem fine, and if you are unaware of encoding you will find no answers in the api docs, because this is a 'language' problem, where you should know the language web APIs usually use. With all being said, if it does prove to be an effort, I agree that it rarely happens because the api provider usually defines the route statically (with the exception of route parameter) It just crossed my mind that we should check that a route is properly encoded (maybe it already happens, I didn't check) when declaring a route |
This was nasty to fix... |
👍 |
Given a route
/existingRoute/{path*}
When requesting
/existingRoute/%/a
Then 400 should be returned
I'm not sure 400 is the right code; 404 means that is is not found but there is a chance that it will be found; is there a way for the path to be found? maybe if you define a route
/existingRoute/%/{path*}
, but is it a valid route?my findings so far (from investigating #1253):
route is decoding url component using these functions:
which means that it treats it as an invalid route (which is ok), but all routes will run this code (or won't event reach it) and, eventually 404 will be returned.
The text was updated successfully, but these errors were encountered: