-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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));
Demo: http://runkit.com/dandv/node-fetch-204-no-content
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).
Metadata
Metadata
Assignees
Labels
No labels