Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (version) {
clientAwarenessHeaders['apollographql-client-version'] = version;
}
}
const contextHeaders = { ...clientAwarenessHeaders, ...context.headers };
const contextConfig = {
http: context.http,
options: context.fetchOptions,
credentials: context.credentials,
headers: contextHeaders,
};
//uses fallback, link, and then context to build options
const { options, body } = selectHttpOptionsAndBody(
operation,
fallbackHttpConfig,
linkConfig,
contextConfig,
);
let controller;
if (!(options as any).signal) {
const { controller: _controller, signal } = createSignalIfSupported();
controller = _controller;
if (controller) (options as any).signal = signal;
}
// If requested, set method to GET if there are no mutations.
const definitionIsMutation = (d: DefinitionNode) => {
return d.kind === 'OperationDefinition' && d.operation === 'mutation';
headers
} = context
const contextConfig = {
http: context.http,
options: context.fetchOptions,
credentials: context.credentials,
headers: {
// Client awareness headers are context overridable.
...(name && { 'apollographql-client-name': name }),
...(version && { 'apollographql-client-version': version }),
...headers
}
}
const { options, body } = selectHttpOptionsAndBody(
operation,
fallbackHttpConfig,
linkConfig,
contextConfig
)
const { clone, files } = extractFiles(body)
const payload = serializeFetchParameter(clone, 'Payload')
if (files.size) {
// Automatically set by fetch when the body is a FormData instance.
delete options.headers['content-type']
// GraphQL multipart request spec:
// https://github.com/jaydenseric/graphql-multipart-request-spec
const optsAndBody = operations.map(operation =>
selectHttpOptionsAndBody(
operation,
fallbackHttpConfig,
linkConfig,
contextConfig,
),
);