superstructor / re-frame-fetch-fx

js/fetch Effect Handler for re-frame
MIT License
40 stars 8 forks source link

Empty response body #5

Closed tggreene closed 2 years ago

tggreene commented 2 years ago

Hello!

Thanks so much for creating this library, it's fantastic :grin:

This PR accounts for a couple of cases where it may not make sense to parse the response body, when the content-length of the response is 0 or when the response code is 204.

Arguably the server should not return a Content-Type: application/json header for a 0 byte body or in the case of a 204 should return Content-Length: 0 but makes the response handling more permissive in bypassing parsing in the two cases above.

Let me know what you think or if you would like the implementation to take a different approach.

superstructor commented 2 years ago

Thanks @tggreene 👍🏻 😄