kopia lustrzana https://gitlab.com/rysiekpl/libresilient
Merge branch 'link2xt/redirect-follow' into 'master'
Follow redirects with `fetch` Closes #85 See merge request rysiekpl/libresilient!29master
commit
4b9f4fb2ec
|
@ -1012,7 +1012,23 @@ let initFromRequest = (req) => {
|
||||||
//mode: req.mode, TODO: commented out because mode: navigate is haram in service worker, it seems
|
//mode: req.mode, TODO: commented out because mode: navigate is haram in service worker, it seems
|
||||||
//credentials: req.credentials, TODO: commented out because credentials: "include" is haram if the Access-Control-Allow-Origin header is '*'
|
//credentials: req.credentials, TODO: commented out because credentials: "include" is haram if the Access-Control-Allow-Origin header is '*'
|
||||||
cache: req.cache,
|
cache: req.cache,
|
||||||
redirect: req.redirect,
|
|
||||||
|
// `req.redirect` is usually "manual":
|
||||||
|
// <https://stackoverflow.com/questions/42716082/fetch-api-whats-the-use-of-redirect-manual>
|
||||||
|
//
|
||||||
|
// It is not useful for fetch() requests
|
||||||
|
// as on redirect it returns a response with "opaqueredirect" type
|
||||||
|
// 0 response code and no way to get actual location:
|
||||||
|
// <https://stackoverflow.com/questions/39735496/redirect-after-a-fetch-post-call>.
|
||||||
|
//
|
||||||
|
// This approach has a drawback of not changing the URL
|
||||||
|
// in a browser when following the redirect for the page
|
||||||
|
// (in contrast to some resource like an image where it does not matter),
|
||||||
|
// but there is no better option until browsers provide some way
|
||||||
|
// to access redirect responses such as the one
|
||||||
|
// proposed in <https://github.com/whatwg/fetch/issues/601>.
|
||||||
|
redirect: "follow",
|
||||||
|
|
||||||
referrer: req.referrer,
|
referrer: req.referrer,
|
||||||
integrity: req.integrity
|
integrity: req.integrity
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue