|
31 | 31 | })
|
32 | 32 | }
|
33 | 33 |
|
| 34 | + var __doRequest |
| 35 | + |
34 | 36 | if (typeof XMLHttpRequest !== 'undefined') {
|
35 |
| - function __doRequest( |
| 37 | + __doRequest = function ( |
36 | 38 | method, url, contentType, accept, headers, body, _onRequestError, callback
|
37 | 39 | ) {
|
38 | 40 | var xhr = new XMLHttpRequest
|
|
52 | 54 | xhr.send(body)
|
53 | 55 | }
|
54 | 56 | } else if (typeof require === 'function') {
|
55 |
| - function __doRequest( |
| 57 | + __doRequest = function ( |
56 | 58 | method, url, contentType, accept, headers, body, onRequestError, callback
|
57 | 59 | ) {
|
58 | 60 | var http = require('http'), https = require('https'), URL = require('url'), uri = URL.parse(url)
|
|
318 | 320 | if (!requestOptions) requestOptions = {}
|
319 | 321 | if (!variables) variables = {}
|
320 | 322 | var fragmentedQuery = that.buildQuery(query, variables)
|
321 |
| - headers = __extend((that.options.headers||{}), (requestOptions.headers||{})) |
| 323 | + var headers = __extend((that.options.headers||{}), (requestOptions.headers||{})) |
322 | 324 |
|
323 | 325 | return new Promise(function (resolve, reject) {
|
324 | 326 | __request(debug, that.options.method || "post", that.getUrl(), headers, {
|
|
504 | 506 | }
|
505 | 507 |
|
506 | 508 | GraphQLClient.prototype.ql = function (strings) {
|
507 |
| - var that = this |
508 | 509 | fragments = Array.prototype.slice.call(arguments, 1)
|
509 | 510 | fragments = fragments.map(function (fragment) {
|
510 | 511 | if (typeof fragment == 'string') {
|
|
529 | 530 | } else {
|
530 | 531 | root.graphql = factory(root.GraphQLClient)
|
531 | 532 | }
|
532 |
| - }(this, function () { |
| 533 | + }(this || self, function () { |
533 | 534 | return GraphQLClient
|
534 | 535 | }))
|
535 | 536 | })()
|
0 commit comments