'Invalid syntax for API request

I'm attempting to make an API request to Braintree's graphql. Whenever I make the request, I keep getting an error that says the following.

{"errors":[{"message":"Invalid Syntax : offending token '<EOF>' at line 1 column 1","locations":[{"line":1,"column":1}]}],"extensions":{"requestId":"e3e6f259-7634-4786-b48f-26e1dc00e186"}}

Here's how I'm making the request.

const request = require('request');
request(
{
  url: 'https://payments.braintree-api.com/graphql',
  headers: {
    "Method": "GET",
    "Authorization": "Basic djRuZHEzMTRjMnM1YzI4cjo5M2I3OGJjODhiZTkwZDkzYWMyODJlNTBhZTU2OWZkZA==",
    "Braintree-Version": "2020-05-07",
    "Content-Type": "application/json",
  },
  body: `{ 
    "query": "query { ping }" }`
}, function(err, res, body) {
    console.log(res.body);
});

Does anyone know why I keep getting this error?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source