mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-15 11:51:30 +00:00
fix: store redirect cookies under initial request domain (#5387)
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user