From 6fbeefa024d7a56d00d6c2322f90b598f693e612 Mon Sep 17 00:00:00 2001 From: Andreas Weber Date: Fri, 26 Aug 2022 20:09:26 +0200 Subject: [PATCH] feat: allow cookieJar options instead of boolean (httpyac/httpyac.github.io#55) --- src/models/environmentConfig.ts | 9 ++++++++- src/plugins/http/cookieJarInterceptor.ts | 6 +++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/models/environmentConfig.ts b/src/models/environmentConfig.ts index 2c240652..a3d6fc4f 100644 --- a/src/models/environmentConfig.ts +++ b/src/models/environmentConfig.ts @@ -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; diff --git a/src/plugins/http/cookieJarInterceptor.ts b/src/plugins/http/cookieJarInterceptor.ts index 64c1eefb..beb6fea4 100644 --- a/src/plugins/http/cookieJarInterceptor.ts +++ b/src/plugins/http/cookieJarInterceptor.ts @@ -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) {