Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Created Issue: Content type with trailing semi-colon handled incorrectly [829]

$
0
0
Had a tricky issue with a customer using our API (implemented using ASP.Net Web API) where by they were using the application/json content type in their requests, but were accidentally appending a trailing semicolon e.g.

Content-Type: application/json;

Instead of normal exception e.g.

No MediaTypeFormatter is available to read an object of type 'foo' from content with media type 'application/json;'

The request is actually handled as if a valid media type was provided, but then fails to bind the model (e.g. the foo object ends up as null).

I think this should either bind correctly, or throw an error (I would prefer it displayed an error).

I see similar behavior when using other variations of application/json e.g. all caps "APPLICATION/JSON" as a content type in the request also causes the same behavior of model being null, but not the typical "no formatter is available to read" etc. errors.

Thoughts?

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>