Skip to content

Commit

Permalink
fix: store cookie
Browse files Browse the repository at this point in the history
  • Loading branch information
bzp2010 committed Sep 14, 2024
1 parent f3b1f4d commit d6b0144
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions libs/backend-api7/e2e/support/global-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,23 @@ const httpClient = axios.create({
}),
});

httpClient.interceptors.response.use((response) => {
if (response.headers['set-cookie']?.[0]) {
//@ts-expect-error forced
response.config.sessionToken = response.headers['set-cookie']?.[0];
}
return response;
});

httpClient.interceptors.request.use(
(config) => {
//@ts-expect-error forced
config.headers['Cookie'] = config.sessionToken;
return config;
},
(error) => Promise.reject(error),
);

const setupAPI7 = async () => {
return new Promise<void>((resolve, reject) => {
const ls = spawn(
Expand Down

0 comments on commit d6b0144

Please sign in to comment.