Skip to content

Commit

Permalink
feat: allow cookieJar options instead of boolean (httpyac/httpyac.git…
Browse files Browse the repository at this point in the history
  • Loading branch information
AnWeber committed Aug 26, 2022
1 parent cb9cf02 commit 6fbeefa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/models/environmentConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ import { LogLevel } from './logHandler';
import { Variables } from './variables';

export interface EnvironmentConfig {
cookieJarEnabled?: boolean;
cookieJarEnabled?:
| boolean
| {
allowSpecialUseDomain?: boolean | undefined;
looseMode?: boolean | undefined;
rejectPublicSuffixes?: boolean | undefined;
prefixSecurity?: string | undefined;
};
log?: {
/** log level of outputs */
level?: LogLevel;
Expand Down
6 changes: 5 additions & 1 deletion src/plugins/http/cookieJarInterceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ export class CookieJarInterceptor implements HookInterceptor<[models.ProcessorCo
}
}
options.memoryStore = memoryStore;
const jar = new CookieJar(memoryStore);
const cookieJarOptions = {};
if (config.cookieJarEnabled !== true) {
Object.assign(cookieJarOptions, config.cookieJarEnabled);
}
const jar = new CookieJar(memoryStore, cookieJarOptions);
if (request.headers && request.url) {
const cookieHeader = utils.getHeader(request.headers, 'cookie');
if (cookieHeader) {
Expand Down

0 comments on commit 6fbeefa

Please sign in to comment.