RestSharp: Deserialization fails when Content-Type is null

I recently found a bug where a DELETE response object causes a null reference exception when the response meets the following:

  • content-type: null
  • body: null
  • content-length: 0

This most likely affects all request types.

Looking through the source the issue appears to be line 624 in RestSharp/RestClient.cs where raw.ContentType is being accessed: if (response.ErrorException == null) { IDeserializer handler = this.GetHandler(raw.ContentType);

There should either be a null check here, or the IRestResponse object raw should be passed into GetHandler() and the null check should be done there.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 29 (10 by maintainers)

Most upvoted comments

any update on above release 106.7