gpt4 book ai didi

javascript - WebAPI 提取是否遵循重定向?

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:38:56 27 4
gpt4 key购买 nike

是否fetch遵循 HTTP 30x 重定向?

最佳答案

是的。 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) {
//...
}

您可以禁用它:

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

关于javascript - WebAPI 提取是否遵循重定向?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53127660/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com