All files graphqlFetchOptions.ts

100% Statements 4/4
100% Branches 0/0
100% Functions 1/1
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20                  16x 35x         35x   35x    
import { GraphQLFetchOptions } from ".."
 
/**
 * Gets default [`fetch` options]{@link GraphQLFetchOptions} for a
 * [GraphQL operation]{@link GraphQLOperation}.
 * @param {GraphQLOperation} operation GraphQL operation.
 * @returns {GraphQLFetchOptions} [`fetch`](https://developer.mozilla.org/docs/Web/API/Fetch_API) options.
 * @ignore
 */
export function graphqlFetchOptions(operation: any) {
  const fetchOptions: GraphQLFetchOptions = {
    url: '/graphql',
    method: 'POST',
    headers: { Accept: 'application/json', 'Content-Type': 'application/json' },
  }
  fetchOptions.body = JSON.stringify(operation)
 
  return fetchOptions
}