-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Return empty object on 204 No Content... #165
Copy link
Copy link
Closed
Milestone
Description
...instead of throwing a syntax error due to attempting to JSON parse ''.
let fetch = require('node-fetch');
fetch('http://httpbin.org/status/204').then(res => res.json()).then(object => {
console.log(object);
}).catch(error => console.error(error));
Fixing this would attain compatibility with request and got.
More generally, it would be more tolerant to return an empty object if the response is the empty string (regardless of the status code being 204 or other 2xx).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels