Skip to content

Commit 05c8404

Browse files
committed
Fix #254 use https module for xhr requests within node if needed
1 parent 8094bf0 commit 05c8404

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/transport/driver/xhr.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
var EventEmitter = require('events').EventEmitter
44
, inherits = require('inherits')
55
, http = require('http')
6+
, https = require('https')
67
, URL = require('url-parse')
78
;
89

@@ -26,7 +27,8 @@ function XhrDriver(method, url, payload, opts) {
2627
, agent: false
2728
};
2829

29-
this.req = http.request(options, function(res) {
30+
var protocol = parsedUrl.protocol === 'https:' ? https : http;
31+
this.req = protocol.request(options, function(res) {
3032
res.setEncoding('utf8');
3133
var responseText = '';
3234

0 commit comments

Comments
 (0)