Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(fetchParams?: BatchHttpLink.Options) {
super();
let {
uri = '/graphql',
// use default global fetch if nothing is passed in
fetch: fetcher,
includeExtensions,
batchInterval,
batchMax,
batchKey,
...requestOptions
} = fetchParams || ({} as BatchHttpLink.Options);
// dev warnings to ensure fetch is present
checkFetcher(fetcher);
//fetcher is set here rather than the destructuring to ensure fetch is
//declared before referencing it. Reference in the destructuring would cause
//a ReferenceError
if (!fetcher) {
fetcher = fetch;
}
const linkConfig = {
http: { includeExtensions },
options: requestOptions.fetchOptions,
credentials: requestOptions.credentials,
headers: requestOptions.headers,
};
this.batchInterval = batchInterval || 10;
export const createHttpLink = (linkOptions: HttpLink.Options = {}) => {
let {
uri = '/graphql',
// use default global fetch if nothing passed in
fetch: fetcher,
includeExtensions,
useGETForQueries,
...requestOptions
} = linkOptions;
// dev warnings to ensure fetch is present
checkFetcher(fetcher);
//fetcher is set here rather than the destructuring to ensure fetch is
//declared before referencing it. Reference in the destructuring would cause
//a ReferenceError
if (!fetcher) {
fetcher = fetch;
}
const linkConfig = {
http: { includeExtensions },
options: requestOptions.fetchOptions,
credentials: requestOptions.credentials,
headers: requestOptions.headers,
};
return new ApolloLink(operation => {