How to use the apollo-link-http-common.checkFetcher function in apollo-link-http-common

To help you get started, we’ve selected a few apollo-link-http-common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github apollographql / apollo-link / packages / apollo-link-batch-http / src / batchHttpLink.ts View on Github external
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;
github apollographql / apollo-link / packages / apollo-link-http / src / httpLink.ts View on Github external
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 => {

apollo-link-http-common

Http utilities for Apollo Link shared across all links using http

MIT
Latest version published 5 years ago

Package Health Score

64 / 100
Full package analysis