ethanent / phin

Node HTTP client
MIT License
576 stars 33 forks source link

Unexpected end of JSON input on 204 response #37

Closed cdimitroulas closed 4 years ago

cdimitroulas commented 5 years ago

Hi there,

I seem to be getting an error from the phin library when an API returns a 204 status code which indicates that the response has no content. This looks like it is due to the parse: "json" option which tries to parse null instead of ignoring it. I will take a look at the source and see if it's an easy fix but just raising this issue for visibility

ethanent commented 4 years ago

For reference: A fix has been made upstream at Centra. A test case was added to Phin. https://github.com/ethanent/centra/commit/e063844f99842815ffdc1f2e654d63616a73ba54