Skip to content
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

Search API should return 400 when passed bad message body and not fall through to a default return value #58

Open
roncanepa opened this issue Mar 4, 2021 · 0 comments

Comments

@roncanepa
Copy link
Contributor

For example: I wrote a request and accidentally did not form the rq object correctly:

# note: this is NOT correct
curl --location --request GET 'https://search.idigbio.org/v2/summary/count/records/' \
--header 'Content-Type: application/json' \
--data-raw '{"recordset": "b40e13f7-a79a-4265-93d9-3b4878dfc988"}'

The expected value is (at time of this issue) ~130k. Instead, we get a return value of 128M. The search api should have noticed that a body was passed as part of the request, that it was malformed, and then returned http 400 instead of returning the total count of all records in iDigBio instead.

Example of correct query:

curl --location --request GET 'https://search.idigbio.org/v2/summary/count/records/' \
--header 'Content-Type: application/json' \
--data-raw '{"rq": {"recordset": "b40e13f7-a79a-4265-93d9-3b4878dfc988"}}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant