WebApi icon indicating copy to clipboard operation
WebApi copied to clipboard

OData returns 500 when a 400 is expected

Open DHoefakker opened this issue 7 years ago • 4 comments

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.

DHoefakker avatar Jun 07 '18 13:06 DHoefakker

I experience this issue in Microsoft.AspNetCore.OData 7.0.0-beta4 as well

rmadisonhaynie avatar Jun 11 '18 15:06 rmadisonhaynie

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

rmadisonhaynie avatar Jun 30 '18 09:06 rmadisonhaynie

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.

NetTecture avatar Oct 16 '18 16:10 NetTecture

Any way to work around this?

hugoqribeiro avatar Jan 05 '24 15:01 hugoqribeiro