Tony Veigel Tony Veigel - 4 months ago 7
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

Edit, Updated

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

plnkr http://plnkr.co/edit/ymKEeudclUp5ydSaijoP?p=preview