WebAPI提取是否遵循重定向? [英] Does WebAPI fetch follow redirects?
本文介绍了WebAPI提取是否遵循重定向?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
fetch 是否遵循HTTP 30x重定向?
Does fetch follow HTTP 30x redirects?
推荐答案
是的。 检查此。
检查响应是否来自重定向的请求与
一样简单,就像在Response对象上检查此标志一样。 / p>
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) {
//...
}
你可以禁用它:
fetch("awesome-picture.jpg", { redirect: "error" }).then(function(response) {
//some stuff
}).then(function(imageBlob) {
//some other stuff
});
这篇关于WebAPI提取是否遵循重定向?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文