From ae144358f83e9f53ef542a6fa3ef42b2b3596f5f Mon Sep 17 00:00:00 2001 From: Mitko Tschimev Date: Mon, 5 Jun 2017 00:15:41 +0200 Subject: [PATCH] Added https support --- graphql.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/graphql.js b/graphql.js index 29ef3d3..fde6a13 100644 --- a/graphql.js +++ b/graphql.js @@ -47,8 +47,8 @@ xhr.onload = function () { callback(JSON.parse(xhr.responseText), xhr.status) } xhr.send(body) } else if (typeof require == 'function') { - var http = require('http'), URL = require('url'), uri = URL.parse(url) - var req = http.request({ + var http = require('http'), https = require('https'), URL = require('url'), uri = URL.parse(url); + var req = (uri.protocol === 'https:' ? https : http).request({ protocol: uri.protocol, hostname: uri.hostname, port: uri.port,