File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ program
3434 . option ( '-I, --header [header]' , 'change the response header property for identifying cached responses' )
3535 . option ( '-l, --log' , 'print log output to console' )
3636 . option ( '-t, --timeout [number]' , 'proxy timeout in milliseconds' , parseInt )
37+ . option ( '-d, --deleteCookieDoman' , 'Remove the Domain portion of all cookies' )
3738 . parse ( process . argv ) ;
3839
3940let configOptions = { } ;
@@ -65,6 +66,7 @@ let dataPlayback = isDef(configOptions.dataPlayback) ? configOptions.dataPlaybac
6566let dataRecord = isDef ( configOptions . dataRecord ) ? configOptions . dataRecord : isDef ( program . disableRecord ) ? ! program . disableRecord : true ;
6667let showConsoleOutput = isDef ( configOptions . showConsoleOutput ) ? configOptions . showConsoleOutput : isDef ( program . log ) ? program . log : false ;
6768let proxyTimeout = configOptions . proxyTimeout ? parseInt ( configOptions . proxyTimeout , 10 ) : program . timeout ;
69+ let deleteCookieDomain = isDef ( configOptions . deleteCookieDomain ) ? configOptions . deleteCookieDomain : isDef ( program . deleteCookieDomain ) ? program . deleteCookieDomain : false ;
6870
6971let excludedRouteMatchers ;
7072if ( configOptions . excludedRouteMatchers && configOptions . excludedRouteMatchers . length > 0 ) {
@@ -95,7 +97,8 @@ let jsonCachingProxy = new JsonCachingProxy({
9597 commandPrefix,
9698 proxyHeaderIdentifier,
9799 showConsoleOutput,
98- proxyTimeout
100+ proxyTimeout,
101+ deleteCookieDomain
99102} ) ;
100103
101104jsonCachingProxy . start ( ) ;
Original file line number Diff line number Diff line change @@ -25,7 +25,8 @@ class JsonCachingProxy {
2525 dataPlayback : true ,
2626 dataRecord : true ,
2727 showConsoleOutput : false ,
28- proxyTimeout : 3600000 // one hour
28+ proxyTimeout : 3600000 , // one hour
29+ deleteCookieDomain : false ,
2930 } ;
3031
3132 // Ignore undefined values and combine the options with defaults
@@ -361,7 +362,7 @@ class JsonCachingProxy {
361362 res . location ( urlUtil . parse ( location ) . path ) ;
362363 }
363364
364- if ( res . _headers [ 'set-cookie' ] ) {
365+ if ( this . options . deleteCookieDomain && res . _headers [ 'set-cookie' ] ) {
365366 res . header ( 'set-cookie' , this . removeCookiesDomain ( res . _headers [ 'set-cookie' ] || [ ] ) ) ;
366367 }
367368
@@ -406,6 +407,7 @@ class JsonCachingProxy {
406407 this . log ( `Command prefix: \t${ chalk . bold ( this . options . commandPrefix ) } ` ) ;
407408 this . log ( `Proxy response header: \t${ chalk . bold ( this . options . proxyHeaderIdentifier ) } ` ) ;
408409 this . log ( `Cache all: \t\t${ chalk . bold ( this . options . cacheEverything ) } ` ) ;
410+ this . log ( `Delete cookies domain: \t${ chalk . bold ( this . options . deleteCookieDomain ) } ` ) ;
409411 this . log ( `Cache busting params: \t${ chalk . bold ( this . options . cacheBustingParams ) } ` ) ;
410412 this . log ( `Excluded routes: ` ) ;
411413 this . options . excludedRouteMatchers . forEach ( ( regExp ) => {
You can’t perform that action at this time.
0 commit comments