Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions graphql.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@
})
}

var __doRequest

if (typeof XMLHttpRequest !== 'undefined') {
function __doRequest(
__doRequest = function (
method, url, contentType, accept, headers, body, _onRequestError, callback
) {
var xhr = new XMLHttpRequest
Expand All @@ -52,7 +54,7 @@
xhr.send(body)
}
} else if (typeof require === 'function') {
function __doRequest(
__doRequest = function (
method, url, contentType, accept, headers, body, onRequestError, callback
) {
var http = require('http'), https = require('https'), URL = require('url'), uri = URL.parse(url)
Expand Down Expand Up @@ -318,7 +320,7 @@
if (!requestOptions) requestOptions = {}
if (!variables) variables = {}
var fragmentedQuery = that.buildQuery(query, variables)
headers = __extend((that.options.headers||{}), (requestOptions.headers||{}))
var headers = __extend((that.options.headers||{}), (requestOptions.headers||{}))

return new Promise(function (resolve, reject) {
__request(debug, that.options.method || "post", that.getUrl(), headers, {
Expand Down Expand Up @@ -504,7 +506,6 @@
}

GraphQLClient.prototype.ql = function (strings) {
var that = this
fragments = Array.prototype.slice.call(arguments, 1)
fragments = fragments.map(function (fragment) {
if (typeof fragment == 'string') {
Expand All @@ -529,7 +530,7 @@
} else {
root.graphql = factory(root.GraphQLClient)
}
}(this, function () {
}(this || self, function () {
return GraphQLClient
}))
})()
Loading