Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function formatDnsLookupUrl(host, url, address) {
if (typeof url === 'string') return url.replace(host, address);
const urlObj = utility.assign({}, url);
urlObj.hostname = urlObj.hostname.replace(host, address);
if (urlObj.host) {
urlObj.host = urlObj.host.replace(host, address);
}
return urlObj;
}
HttpClient.prototype.requestThunk = function (url, args) {
args = args || {};
if (this.defaultArgs) {
args = utility.assign({}, [ this.defaultArgs, args ]);
}
args.emitter = this;
args.agent = getAgent(args.agent, this.agent);
args.httpsAgent = getAgent(args.httpsAgent, this.httpsAgent);
return urllib.requestThunk(url, args);
};
HttpClient.prototype.request = HttpClient.prototype.curl = function (url, args, callback) {
if (typeof args === 'function') {
callback = args;
args = null;
}
args = args || {};
if (this.defaultArgs) {
args = utility.assign({}, [ this.defaultArgs, args ]);
}
args.emitter = this;
args.agent = getAgent(args.agent, this.agent);
args.httpsAgent = getAgent(args.httpsAgent, this.httpsAgent);
return urllib.request(url, args, callback);
};
get locals() {
if (!this[LOCALS]) {
this[LOCALS] = assign({}, this.app.locals);
}
if (this[LOCALS_LIST] && this[LOCALS_LIST].length) {
assign(this[LOCALS], this[LOCALS_LIST]);
this[LOCALS_LIST] = null;
}
return this[LOCALS];
},
HttpClient.prototype.request = HttpClient.prototype.curl = function (url, args, callback) {
if (typeof args === 'function') {
callback = args;
args = null;
}
args = args || {};
if (this.defaultArgs) {
args = utility.assign({}, [this.defaultArgs, args]);
}
args.emitter = this;
args.agent = getAgent(args.agent, this.agent);
args.httpsAgent = getAgent(args.httpsAgent, this.httpsAgent);
return urllib.request(url, args, callback);
};
HttpClient.prototype.requestThunk = function (url, args) {
args = args || {};
if (this.defaultArgs) {
args = utility.assign({}, [this.defaultArgs, args]);
}
args.emitter = this;
args.agent = getAgent(args.agent, this.agent);
args.httpsAgent = getAgent(args.httpsAgent, this.httpsAgent);
return urllib.requestThunk(url, args);
};
get locals() {
if (!this[LOCALS]) {
this[LOCALS] = assign({}, this.app.locals);
}
if (this[LOCALS_LIST] && this[LOCALS_LIST].length) {
assign(this[LOCALS], this[LOCALS_LIST]);
this[LOCALS_LIST] = null;
}
return this[LOCALS];
},
set locals(val) {
if (!this[LOCALS]) {
this[LOCALS] = {};
}
assign(this[LOCALS], val);
}