title: Testing GraphQL API
body: <p>I'm testing my GraphQL API, but I would like to clean it up a little bit. It's worth noting I'm using <code>chai-http</code> for the network requests. Here's what I'm currently doing (which works):</p>
  
  <pre><code>let createUser = (()=&gt; {
    return new Promise((resolve, reject) =&gt; {
      chai.request(server)
        .post('/api/graphql/')
        .set('content-type', 'application/json')
        .send({ 'query' : 
          'mutation users { \
            user : addUser(inputs: { \
              firstName: \"Test\", \
              lastName: \"User\", \
              email: \"test@test.com\", \
            }) { \
              id, \
              firstName \
            } \
          }'
        })
        .end((err, res) =&gt; {
          if (err) { reject(err) }
          let data = res.body.data;
          let user = data.user;
          resolve(user);
        })
    });
  });
  </code></pre>
  
  <p>However, I would like to clean it up a bit and do something like this:</p>
  
  <pre><code>let createUser = (() =&gt; {
    let newUser = {
      firstName: 'Test',
      lastName: 'User',
      email: 'test@test.com'
    };
  
    return new Promise((resolve, reject) =&gt; {
      chai.request(server)
        .post('/api/graphql/')
        .set('content-type', 'application/json')
        .send({ 'query' : 
          'mutation users { \
            user : addUser(inputs: ' + JSON.stringify(newUser) + ') { \
              id, \
              firstName \
            } \
          }'
        })
        .end((err, res) =&gt; {
          if (err) { reject(err) }
          let data = res.body.data;
          let user = data.user;
          resolve(user);
        })
    });
  });
  </code></pre>
  
  <p>However, this style does of placing the object inputs does not work and returns a bad request error. Here is what part of the returned error object reads:</p>
  
  <p><a href="https://i.stack.imgur.com/08XoE.png" rel="noreferrer"><img src="https://i.stack.imgur.com/08XoE.png" alt="enter image description here"></a></p>
  
  <p>Any ideas why this doesn't work? Thanks in advance!</p>