In a ReactJS Component, a fetch call to an API that redirects to another API won't return the final destination's response. Fetch simply returns opaque
response with null 0 etc as if your call failed. It doesn't even say it redirected. But in Chrome's console, the Network tab clearly showed the redirected call succeeded.
let call = fetch(encodedQueryUrl, {
method: 'GET',
cache: 'no-cache',
mode: 'no-cors',
redirect: 'follow',
credentials: 'same-origin'
}).then((response) => {
console.log("Response???", response);
return response;
});
So encodedQueryURL Response Headers:
Request Method: GET
Status Code: 302
Referrer Policy: no-referrer-when-downgrade
Access-Control-Allow-Headers: access-control-allow-origin
Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE
Access-Control-Allow-Origin: *
content-length: 0
content-type: text/html; charset=UTF-8
And the 302 Response headers:
Request Method: GET
Status Code: 200
Referrer Policy: no-referrer-when-downgrade
Access-Control-Allow-Headers: access-control-allow-origin
access-control-allow-methods: GET, POST, GET, OPTIONS, PUT, DELETE
access-control-allow-origin: *
content-type: application/json; charset=UTF-8