wrong content-type for 422 validation failure


Seems to be set to text/html instead of application/json;profile=".../error"

a stack trace from fiddler:

POST http://localhost:6565/services/sdm.restserver.RestApi.MeansAssessmentRestApi/actions/CreateMeansAssessment/invoke HTTP/1.1
Accept: application/json, application/xml, text/json, text/x-json, text/javascript, text/xml, application/json
User-Agent: RestSharp
Content-Type: application/json
Host: localhost:6565
Content-Length: 135
Accept-Encoding: gzip, deflate

{"Context":{"value":{"href":""}},"Date of Effect":{"value":"2013-02-21T12:05:42.4677636"}}


HTTP/1.1 422 Unprocessable Entity
Server: ASP.NET Development Server/
Date: Thu, 21 Feb 2013 12:05:47 GMT
X-AspNet-Version: 4.0.30319
Pragma: no-cache
Warning: 199 RestfulObjects "Context is not valid"
Warning: 199 RestfulObjects "Context is not valid"
Cache-Control: no-cache
Expires: Thu, 21 Feb 2013 12:05:47 GMT
Content-Type: text/html
Content-Length: 214
Connection: Close

{"Context":{"value":{"href":""},"invalidReason":"Context is not valid"},"Date of Effect":{"value":"2013-02-21T12:05:42.4677636Z","invalidReason":"Context is not valid"}}
Closed May 9, 2013 at 3:30 PM by RichardPawson


scascarini wrote Feb 21, 2013 at 3:40 PM

Happy to implement - however the spec does not define any Content-Type header for a 422 error. I assume web-api is just defaulting to text/html as it's not being explicitly set.