Skip to content

Instantly share code, notes, and snippets.

import { RemoteGraphQLDataSource } from '@apollo/gateway';
import { fetch, Headers, Request } from 'apollo-server-env';
import { isObject } from '@apollo/gateway/dist/utilities/predicates';
import _, { get } from 'lodash';
import FormData from 'form-data';
class FileUploadDataSource extends RemoteGraphQLDataSource {
willSendRequest({ request, context }) {
const headers = get(request, 'http.headers', {});
const authorization = get(context, 'headers.authorization', '');