added suggestCompression config

This commit is contained in:
Spencer Alger
2014-09-04 16:02:49 -07:00
parent a0ffe50745
commit 6e2c2a8417
2 changed files with 46 additions and 3 deletions

View File

@ -11,7 +11,8 @@ var hostDefaults = {
path: '',
auth: null,
query: {},
headers: null
headers: null,
suggestCompression: false
};
describe('Host class', function () {
@ -169,4 +170,36 @@ describe('Host class', function () {
});
});
describe('#getHeaders', function () {
it('merges the passed in headers with the default headers', function () {
var host = new Host({ headers: { 'Joe-Smith': 'present' } });
expect(host.getHeaders({
'John-Smith': 'present'
})).to.eql({
'John-Smith': 'present',
'Joe-Smith': 'present'
});
});
it('overrides the default headers with the passed in headers', function () {
var host = new Host({ headers: { 'Joe-Smith': 'present' } });
expect(host.getHeaders({
'John-Smith': 'present',
'Joe-Smith': 'absent'
})).to.eql({
'John-Smith': 'present',
'Joe-Smith': 'absent'
});
});
it('adds Accept-Encoding header when the suggestCompression setting is true', function () {
var host = new Host({ suggestCompression: true });
expect(host.getHeaders()).to.eql({
'Accept-Encoding': 'gzip,deflate'
});
});
});
});