track the global config and pass it to the host objects on creation

This commit is contained in:
Spencer Alger
2014-09-08 15:32:06 -07:00
parent eb4e0136a6
commit 4e4c59dcec
2 changed files with 7 additions and 5 deletions

View File

@ -23,8 +23,9 @@ Host.defaultPorts = {
https: 443
};
function Host(config) {
function Host(config, globalConfig) {
config = config || {};
globalConfig = globalConfig || {};
// defaults
this.protocol = 'http';
@ -34,7 +35,7 @@ function Host(config) {
this.auth = null;
this.query = null;
this.headers = null;
this.suggestCompression = false;
this.suggestCompression = !!globalConfig.suggestCompression;
if (typeof config === 'string') {
if (!startsWithProtocolRE.test(config)) {