-
Notifications
You must be signed in to change notification settings - Fork 37
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
not found should return 404 #20
Comments
Hi. This one is a little tricky. While I totally get your point I decided not to implement this. The reason: Hopefully this is understandable. Regrards |
Well, I kind of get your point but 404 doesn't say that the url is invalid, it says that the resource is unavailable, which it isn't for that person doing the request. But even if you dislike 404, i think it is closer to correct than 200 Ok. It's also more annoying while implementing it since you'll need to specially check if there is an error even when the response was a success. So this simple js implementation (which did work with freegeoip.net) is now flawed (pseudo implementation) fetch('http://geoip.nekudo.com/api')
.then(response => console.log('success', response))
.catch(error => console.error('error', error)) I now need something likes this fetch('http://geoip.nekudo.com/api')
.then(response => response.type === 'error' ? Promise.reject(response) : response)
.then(response => console.log('success', response))
.catch(error => console.error('error', error)) That is neither intuitive nor documented on your start page https://geoip.nekudo.com There are also some alternatives if you dislike 404, like 400 Bad Request or even 500 would be better imo. I'd even go as far and say 418 is better than 200 because at least it's an error code. |
Fair point. I'll give this another thought. (As soon as I can spare a few hours) |
When I request http://geoip.nekudo.com/api/127.0.0.1 then I get an error which is correct, but the http status is 200. The http status should be 404.
The text was updated successfully, but these errors were encountered: