handle GET reqs with invalid query params as 400 #839
+121
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Currently, when an user inputs a request with a query param that has an invalid syntax issue, it gets processed as a 500 internal service error. We should be processing these as a 400 bad request instead.
Link to original Jira with more details: https://issues.redhat.com/browse/RHOAIENG-19195
How Has This Been Tested?
This has been locally tested by creating new registered models and model artifacts, and then sending GET requests with bad query params for name and externalId in order to trigger the "Illegal syntax" error. For example:
GET /api/model_registry/v1alpha3/registered_model?%C3%B5%F1%A5%BC%A2x%1D%1C&externalId=1l%26%F3%AF%81%9Fd%F0%96%B0%AD%5C-%10%C3%AD%09%C3%BD%F3%BF%B9%B0%C2%98%C3%8B%C3%A7%F0%BF%BD%A4%3D%C2%BB%C2%B0%C3%AF
Merge criteria:
DCO
check)