How to use the apollo-client/transport/networkInterface.printRequest function in apollo-client

To help you get started, we’ve selected a few apollo-client 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 silverstripe / silverstripe-admin / client / src / boot / buildApolloClient.js View on Github external
applyMiddleware(req, next) {
      const entries = printRequest(req.request);

      // eslint-disable-next-line no-param-reassign
      req.options.headers = Object.assign(
        {},
        req.options.headers,
        {
          'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
          'X-CSRF-TOKEN': Config.get('SecurityID'),
        }
      );
      // eslint-disable-next-line no-param-reassign
      req.options.body = qs.stringify(Object.assign(
        {},
        entries,
        { variables: JSON.stringify(entries.variables) }
      ));
github drupal-graphql / drupal-decoupled-app / frontend / app / shared / state / configureApolloClient.js View on Github external
const printRequest = request => {
  if (!Object.hasOwnProperty.call(request, 'query')) {
    return request;
  }

  const printedRequest = doPrintRequest(request);
  return {
    ...printedRequest,
    query: printedRequest.query.replace(/\s{2,}/g, ' '),
  };
};
github drupal-graphql / drupal-decoupled-app / frontend / app / shared / state / configureApolloClient.js View on Github external
const printRequest = request => {
  if (!Object.hasOwnProperty.call(request, 'query')) {
    return request;
  }

  const printedRequest = doPrintRequest(request);
  return {
    ...printedRequest,
    query: printedRequest.query.replace(/\s{2,}/g, ' '),
  };
};
github vic / apollo-phoenix-websocket / src / index.js View on Github external
const performQuery = ({channel, context}) => new Promise((resolve, reject) => {
  const {options, request} = context

  const message = docEvent(options)
  const payload = printRequest(request)

  channel.push(message, payload)
    .receive('ok', resolve)
    .receive('ignore', resolve)
    .receive('error', reject)
    .receive('timeout', reject)
})