Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (init) {
Object.assign(trueInit, defaultInit, init);
} else {
Object.assign(trueInit, defaultInit);
}
trueInit.headers = mergeHeaders([
defaultInit.headers,
// @ts-ignore cross-fetch definitions are broken. See https://github.com/lquixada/cross-fetch/pull/19
input instanceof crossFetch.Request ? input.headers : null,
init && init.headers ? init.headers : null
]);
// @ts-ignore cross-fetch definitions are broken. See https://github.com/lquixada/cross-fetch/pull/19
return new crossFetch.Request(input, trueInit);
}
// in newInit.
if (init) {
for(var key in init) {
if (key==='headers') {
// special case.
continue;
}
newInit[key] = init[key];
}
newInit.headers = mergeHeaders([
newInit.headers,
init.headers
]);
}
var request = new fetch.Request(uri, newInit);
return this.client.fetch(request);
},
protected async getRequest(document: DocumentNode, variables?: { [name: string]: any }, context?: any, introspect?: boolean): Promise {
return new Request(this.url, {
method: 'POST',
headers: await this.getHeaders(document, variables, context, introspect),
body: await this.getBody(document, variables, context)
});
}