Skip to content

Commit 26241ac

Browse files
authored
Merge pull request #11 from sonyseng/develop
Add delete cookie domain command line option
2 parents 87e875f + 804cc13 commit 26241ac

File tree

12 files changed

+3375
-1458
lines changed

12 files changed

+3375
-1458
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
text=lf

README.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ $ npm install -D json-caching-proxy
3535
-I, --header [header] change the response header property for identifying cached responses
3636
-l, --log print log output to console
3737
-t, --timeout change the timeout for proxy server
38+
-d, --deleteCookieDomain Remove the Domain portion of all cookies
3839
```
3940

4041
#### Example - basic JSON caching with output
@@ -85,13 +86,6 @@ $ json-caching-proxy -u http://remote:8080 -p 3001 -b time:dc -e '/keepalive' -H
8586
$ json-caching-proxy --config config.json
8687
```
8788

88-
#### Example - print log output to the console
89-
Setting the `showConsoleOutput` value to `true` will start showing the requests being made through the proxy. If the request is cacheable, it will also show the hash key for each request:
90-
91-
![Console output](http://sonyseng.github.io/json-caching-proxy/images/caching-proxy1.png)
92-
93-
![Console output](http://sonyseng.github.io/json-caching-proxy/images/caching-proxy2.png)
94-
9589
## Programmatic Usage
9690

9791
API docs can be found here: [JsonCachingProxy doc](http://sonyseng.github.io/json-caching-proxy/jsdoc/JsonCachingProxy.html)
@@ -113,7 +107,8 @@ let jsonCachingProxy = new JsonCachingProxy({
113107
dataPlayback: true,
114108
dataRecord: true,
115109
showConsoleOutput: false,
116-
proxyTimeout: 500000
110+
proxyTimeout: 500000,
111+
deleteCookieDomain: true
117112
});
118113

119114
jsonCachingProxy.start();

bin.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff 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, --deleteCookieDomain', 'Remove the Domain portion of all cookies')
3738
.parse(process.argv);
3839

3940
let configOptions = {};
@@ -65,6 +66,7 @@ let dataPlayback = isDef(configOptions.dataPlayback) ? configOptions.dataPlaybac
6566
let dataRecord = isDef(configOptions.dataRecord) ? configOptions.dataRecord : isDef(program.disableRecord) ? !program.disableRecord : true;
6667
let showConsoleOutput = isDef(configOptions.showConsoleOutput) ? configOptions.showConsoleOutput : isDef(program.log) ? program.log : false;
6768
let proxyTimeout = configOptions.proxyTimeout ? parseInt(configOptions.proxyTimeout, 10) : program.timeout;
69+
let deleteCookieDomain = isDef(configOptions.deleteCookieDomain) ? configOptions.deleteCookieDomain : isDef(program.deleteCookieDomain) ? program.deleteCookieDomain : false;
6870

6971
let excludedRouteMatchers;
7072
if (configOptions.excludedRouteMatchers && configOptions.excludedRouteMatchers.length > 0) {
@@ -94,8 +96,9 @@ let jsonCachingProxy = new JsonCachingProxy({
9496
dataRecord,
9597
commandPrefix,
9698
proxyHeaderIdentifier,
97-
showConsoleOutput,
98-
proxyTimeout
99+
showConsoleOutput,
100+
proxyTimeout,
101+
deleteCookieDomain
99102
});
100103

101104
jsonCachingProxy.start();

0 commit comments

Comments
 (0)