Skip to content

Commit e7b0064

Browse files
committed
set headers
1 parent 711770c commit e7b0064

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

graphql.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
if (!options.fragments)
9797
options.fragments = {}
9898

99-
this.options = options
99+
this.options = options || {}
100100
this._fragments = this.buildFragments(options.fragments)
101101
this._sender = this.createSenderFunction(url)
102102
this.createHelpers(this._sender)
@@ -311,7 +311,11 @@
311311
}
312312

313313
GraphQLClient.prototype.getOptions = function () {
314-
return this.options
314+
return this.options || {}
315+
}
316+
317+
GraphQLClient.prototype.headers = function (newHeaders) {
318+
return this.options.headers = __extend(this.options.headers, newHeaders)
315319
}
316320

317321
GraphQLClient.prototype.fragment = function (fragment) {

graphql.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)