Making requests that responds with HTTP 200 without a body throws due to naive property reading.
TypeError: Cannot read property 'toString' of undefined
What's changed?
Inline checking that res.body is truthy before invoking res.body.toString. In the case that we don't get a response body, return true like we do for HTTP 204 responses.
How can this be verified?
Should no longer throw when receiving a HTTP 200 response without body. Tested successfully in my environment.
What's the problem?
Making requests that responds with
HTTP 200
without a body throws due to naive property reading.What's changed?
Inline checking that
res.body
is truthy before invokingres.body.toString
. In the case that we don't get a response body, returntrue
like we do forHTTP 204
responses.How can this be verified?
Should no longer throw when receiving a
HTTP 200
response without body. Tested successfully in my environment.