diff --git a/lib/http.js b/lib/http.js index c18a8683df9..1a1e6d75457 100644 --- a/lib/http.js +++ b/lib/http.js @@ -1437,12 +1437,12 @@ function getAgent(options) { var _opts = {}; - if (options instanceof String) { + if (typeof options === 'string') { port = arguments[1] || 80; id = options + ':' + port; _opts.host = options; _opts.port = port; - } else if (options instanceof Object) { + } else if (options && options === 'object') { if (options.port || options.host) { host = options.host || 'localhost'; port = options.port || 80;