WebApi
WebApi copied to clipboard
OData returns 500 when a 400 is expected
A couple of requests return a HTTP 500 when a 400 is expected due to incorrect format of the request. The requests are :
- $top=
- $skip=
- $select=
- $top=-0 (this returns a 200, i know it's doubtful)
Assemblies affected
OData WebApi lib 6.1.0
Reproduce steps
Just call your OData endpoint with the above (empty) operators
Expected result
I expect a HTTP 400
Actual result
I get a HTTP 500
Additional detail
Optional, details of the root cause if known. Delete this section if you have no additional details to add.
I experience this issue in Microsoft.AspNetCore.OData 7.0.0-beta4 as well
I also want to add a 500 gets returned for query params like
$select=Props
where Props doesn't actually exist on the entity, similarly for $expand
And again under #1646 - Syntax errors are swallowed in general, leaving zero relevant information to the user of an API. This is resulting on our end into a high number of simple bugs where we have to investigatge test cases just to get the internal error so we can provide end users with error information.
Any way to work around this?