I have a resource called
Logins, and I invoke a
GET via AJAX from the browser. The current behavior is to return a 404 when the specific login cannot be found.
I'm using this to check whether a username is in use or not. (when creating a new user, the username must be unique)
The AJAX code works fine and can read the response's status code, however, the browser's (firefox) console flags it as an error (all 404s are). This leads me to believe that it may not be the best idea to give non-successful type responses to browsers.
I'd rather not have the browser treat this as an exceptional case and flag it as an error in the console, mainly because it's alarming when the developer tools light up.
- Ignore the console, 404s are perfectly valid in this case.
- Avoid using 4xx status code responses and return a less 'restful' response.
- Change the resource as
Loginsdoesn't make sense for the use-case.
- Something else...
Browsers are the only consumer of this API, so I can change it anyway that best suits them.