fix: store redirect cookies under initial request domain (#5387)

This commit is contained in:
Pooja
2025-08-29 21:05:18 +05:30
committed by GitHub
parent ba56e87375
commit de48c93e8d
3 changed files with 34 additions and 2 deletions

View File

@@ -111,7 +111,7 @@ function makeAxiosInstance({ requestMaxRedirects = 5, disableCookies } = {}) {
}
if (!disableCookies){
saveCookies(redirectUrl, error.response.headers);
saveCookies(error.config.url, error.response.headers);
}
const requestConfig = createRedirectConfig(error, redirectUrl);

View File

@@ -297,7 +297,7 @@ function makeAxiosInstance({
}
if (preferencesUtil.shouldStoreCookies()) {
saveCookies(redirectUrl, error.response.headers);
saveCookies(error.config.url, error.response.headers);
}
// Create a new request config for the redirect

View File

@@ -0,0 +1,32 @@
meta {
name: Redirect Cookie Save
type: http
seq: 9
}
get {
url: https://httpbun.com/mix/s=302/c=foo:bar/r=https%3A%2F%2Fhttpbun.org%2Fget
body: none
auth: inherit
}
tests {
const jar = bru.cookies.jar()
const cookieData = await jar.getCookie(
"https://httpbun.com",
"foo"
);
test("should store redirect cookie under initial request domain", function () {
expect(cookieData).to.not.be.undefined;
expect(cookieData.key).to.equal("foo");
expect(cookieData.value).to.equal("bar");
});
jar.clear();
}
settings {
encodeUrl: true
}