Does WebAPI fetch follow redirects?

Does fetch follow HTTP 30x redirects?

Answers:

Answer

Yes. Check this.

Checking to see if the response comes from a redirected request is as simple as checking this flag on the Response object.

 if (response.redirected) {
   //...
 }

You can disable it:

fetch("awesome-picture.jpg", { redirect: "error" }).then(function(response) {
  //some stuff
}).then(function(imageBlob) {
  //some other stuff
});

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.