Skip to content

Commit

Permalink
fix(requestOption): stop caching headers
Browse files Browse the repository at this point in the history
caching caused the x-ems-header to get out of date
  • Loading branch information
barna-emarsys committed Jan 29, 2018
1 parent adc9fcc commit bc37793
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/requestOption.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class SuiteRequestOption {
const hash = {
port: this.port,
host: this.host,
headers: this.headers,
headers: this.headers.slice(0),
prefix: this.prefix,
timeout: this.timeout,
maxContentLength: this.maxContentLength
Expand Down
6 changes: 6 additions & 0 deletions lib/requestOption.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ describe('SuiteRequestOption', function() {

expect(requestOptions.toHash()).to.have.property('allowEmptyResponse', true);
});

it('should not cache headers', function() {
const requestOptions = new SuiteRequestOption(dummyServiceConfig.host, dummyServiceConfig);
requestOptions.toHash().headers.push('from_test');
expect(requestOptions.toHash().headers).not.to.include('from_test');
});
});

});

0 comments on commit bc37793

Please sign in to comment.