Skip to content

Commit 202d32e

Browse files
Fix http2 agent doesn't work with request module
Fix molnarg#174
1 parent daa7e05 commit 202d32e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/http.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,12 @@ function requestTLS(options, callback) {
834834
if (options.protocol && options.protocol !== "https:") {
835835
throw new Error('This interface only supports https-schemed URLs');
836836
}
837-
return (options.agent || exports.globalAgent).request(options, callback);
837+
if (options.agent && typeof(options.agent.request) === 'function') {
838+
var agentOptions = util._extend({}, options);
839+
delete agentOptions.agent;
840+
return options.agent.request(agentOptions, callback);
841+
}
842+
return exports.globalAgent.request(options, callback);
838843
}
839844

840845
function getRaw(options, callback) {

0 commit comments

Comments
 (0)