reqwest icon indicating copy to clipboard operation
reqwest copied to clipboard

Response without any content (e.g. 204 No Content) returns the XHR object itself instead of empty response

Open DCoderLT opened this issue 10 years ago • 0 comments

When handling an empty response, at reqwest.js#324, the entire if() that transforms resp from the XHR object to the parsed response content is skipped due to r being empty, and the completion callbacks afterwards use the old value of resp, the XHR object itself, as the response.

It seems quite surprising to receive a non-empty response in this case. This behaviour can be worked around using dataFilter, but it seems to me that the library should be handling this internally.

DCoderLT avatar Feb 13 '16 15:02 DCoderLT