Hello, I am making a request to a URL and the request is not formatted as JSON yet whenever I call response.text() my promise never resolves. The response text is a bit lengthy, so could that be a possible factor? Are there any alternatives to Fetch that could resolve this?
fetch('https://www.youtube.com/watch?v=4Tr0otuiQuU') .then(response => { return response.text().then((mu) => console.log('mu' + mu)); })
The console never prints out the mu variable, yet whenever I try response.json() I get a unexpected token error cannot parse "<" ..etc which correctly indicates that fetch was able to obtain the HTML page and the response HTTP status is 200.
I've also tried the alternative
fetch('https://www.youtube.com/watch?v=4Tr0otuiQuU') .then(response => { return response.text() }) .then(.mu => console.log('mu' + mu))
Hello, I am making a request to a URL and the request is not formatted as JSON yet whenever I call response.text() my promise never resolves. The response text is a bit lengthy, so could that be a possible factor? Are there any alternatives to Fetch that could resolve this?
fetch('https://www.youtube.com/watch?v=4Tr0otuiQuU') .then(response => { return response.text().then((mu) => console.log('mu' + mu)); })The console never prints out the
muvariable, yet whenever I tryresponse.json()I get a unexpected token error cannot parse "<" ..etc which correctly indicates that fetch was able to obtain the HTML page and the response HTTP status is 200.I've also tried the alternative
fetch('https://www.youtube.com/watch?v=4Tr0otuiQuU') .then(response => { return response.text() }) .then(.mu => console.log('mu' + mu))