Skip to content

Commit

Permalink
Respect user provided cookies when rememberCookiesForSubsequentReques…
Browse files Browse the repository at this point in the history
…ts is set to false #507
  • Loading branch information
Huachao committed Feb 4, 2020
1 parent 2781453 commit 522ea7e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/utils/httpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,13 @@ export class HttpClient {
hooks: {
beforeRequest: [
opts => {
const cookieString = this.cookieJar.getCookieStringSync(httpRequest.url, { expire: true });
if (cookieString) {
opts.headers!.cookie = [cookieString, getHeader(httpRequest.headers, 'cookie')].filter(Boolean).join('; ');
if (this._settings.rememberCookiesForSubsequentRequests) {
const cookieString = this.cookieJar.getCookieStringSync(httpRequest.url, { expire: true });
if (cookieString) {
opts.headers!.cookie = [cookieString, getHeader(httpRequest.headers, 'cookie')].filter(Boolean).join('; ');
}
}

}
],
afterResponse: [
Expand Down

0 comments on commit 522ea7e

Please sign in to comment.