diff --git a/lib/transport/driver/xhr.js b/lib/transport/driver/xhr.js index 440d3c79..ccf65fef 100644 --- a/lib/transport/driver/xhr.js +++ b/lib/transport/driver/xhr.js @@ -3,6 +3,7 @@ var EventEmitter = require('events').EventEmitter , inherits = require('inherits') , http = require('http') + , https = require('https') , URL = require('url-parse') ; @@ -26,7 +27,8 @@ function XhrDriver(method, url, payload, opts) { , agent: false }; - this.req = http.request(options, function(res) { + var protocol = parsedUrl.protocol === 'https:' ? https : http; + this.req = protocol.request(options, function(res) { res.setEncoding('utf8'); var responseText = '';