Tony Veigel Tony Veigel - 1 year ago 49
Javascript Question

"unexpected end of output" error on response.json()

I keep getting an "unexpected end of output" error on response.json(). Am I way off base on what I am doing below?

Promise.all([requestOne, requestTwo])
.then(responses => {
responses.reduce((promise,response) => {
return promise.then(() => {
return response.json()
}).then(result => result)
}, Promise.resolve());

Answer Source

Edit, Updated

The issue is {mode:"no-cors"} setting at fetch. Substitute {method: "get"} for {mode:"no-cors"} at fetch call