title: Send POST request to apollo server with "operationName" and "variables"
body: <p>I follow this doc <a href="https://www.apollographql.com/docs/apollo-server/requests.html#postRequests" rel="nofollow noreferrer">https://www.apollographql.com/docs/apollo-server/requests.html#postRequests</a> and try to send a <code>POST</code> request to apollo server.</p>
  
  <p>test code: </p>
  
  <pre class="lang-js prettyprint-override"><code>it('should get author correctly', () =&gt; {
      const body = {
        query: `
          query {
            getAuthor($id: Int!) {
              name
            }
          }
        `,
        // operationName: 'query author',
        variables: {
          id: 1
        }
      };
      return rp.post(body).then(res =&gt; {
        expect(res.data.getAuthor.name).to.equal('lin');
      });
    });
  </code></pre>
  
  <p><code>rp.js</code>: </p>
  
  <pre class="lang-js prettyprint-override"><code>const requestPromise = require('request-promise');
  const { PORT } = require('./config');
  
  const GRAPHQL_ENDPOINT = `http://localhost:${PORT}/graphql`;
  
  function rp(options) {
    function post(body) {
      return requestPromise(GRAPHQL_ENDPOINT, {
        method: 'POST',
        body,
        json: true,
        headers: {
          'Content-Type': 'application/json'
        }
      });
    }
  
    return {
      post
    };
  }
  
  module.exports = rp;
  </code></pre>
  
  <p>When I run <code>npm test</code> command, got an error: </p>
  
  <pre class="lang-sh prettyprint-override"><code>graphql test suites
  Go to http://localhost:3000/graphiql to run queries!
      ✓ t0
      1) should get author correctly
  
  
    1 passing (79ms)
    1 failing
  
    1) graphql test suites
         should get author correctly:
       StatusCodeError: 400 - {"errors":[{"message":"Syntax Error: Expected Name, found $","locations":[{"line":3,"column":21}]}]}
        at new StatusCodeError (node_modules/request-promise-core/lib/errors.js:32:15)
        at Request.plumbing.callback (node_modules/request-promise-core/lib/plumbing.js:104:33)
        at Request.RP$callback [as _callback] (node_modules/request-promise-core/lib/plumbing.js:46:31)
        at Request.self.callback (node_modules/request/request.js:186:22)
        at Request.&lt;anonymous&gt; (node_modules/request/request.js:1163:10)
        at IncomingMessage.&lt;anonymous&gt; (node_modules/request/request.js:1085:12)
        at endReadableNT (_stream_readable.js:1106:12)
        at process._tickCallback (internal/process/next_tick.js:178:19)
  </code></pre>