-
Notifications
You must be signed in to change notification settings - Fork 8
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
Provide a 404 when user passes a malformed library ID #89
Comments
I can confirm the 500 error when the library ID input is not valid. We want status 404 if the input is valid but does not exist. We want status 400 if the input is invalid for example if it is 21 characters instead of 22. For me https://api.adsabs.harvard.edu/v1/biblib/libraries/STjgfb_7QhSQOG511cvs1g returns 200 but https://api.adsabs.harvard.edu/v1/biblib/libraries/STjgfb_7QhSQOG511cvs1 returns 500. The problem was client side not server side so should be in the status 4XX range |
This is the exception that is raised with bad library IDs:
Library ID Biblib base view adds two '==' to that string see, and then it uses base64.urlsafe_b64decode to decode. Since the example lacks 1 characters, we would need to append |
Currently, the API will return a 410 (which should be a 404 really) if someone passes a library ID that does not exist. However, if someone passes a malformed ID, such as 'foo', this will return a 500 as the ID conversion, of course, crashes. This should be handled, and return a 400.
The text was updated successfully, but these errors were encountered: