Javascript Betfair API调用400错误响应使用fetch,我哪里出错了?

Javascript Betfair API调用400错误响应使用fetch,我哪里出错了?,javascript,node.js,fetch,betfair,Javascript,Node.js,Fetch,Betfair,我觉得使用node.js可以很简单地完成这一点,但是响应总是以400错误的形式返回,下面是我的代码,不需要调试。我开始怀疑API文档是否有缺陷 const fetch = require("node-fetch"); const apiKey = 'APP-KEY'; const sessionId = 'SESSION-KEY' const url = "https://api.betfair.com/exchange/betting/json-rpc/v1&q

我觉得使用node.js可以很简单地完成这一点,但是响应总是以400错误的形式返回,下面是我的代码,不需要调试。我开始怀疑API文档是否有缺陷

const fetch = require("node-fetch");

const apiKey = 'APP-KEY';
const sessionId = 'SESSION-KEY'
const url = "https://api.betfair.com/exchange/betting/json-rpc/v1"

async function listEventTypes()
{
    const body = '[{"jsonrpc": "2.0", "method": "SportsAPING/v1.0/listEventTypes", "params": {"filter":{}}, "id": 1}]';
    const response = await fetch(url, {
        method: 'POST',
        headers: {
            'X-Application' : apiKey,
            'X-Authentication' : sessionId,
            'Accept' : 'application/json',
            'Content-type' : 'application/json'
        },
        data: body          
    }).then(response => {
    if (response.ok) {
      return response.json();
    }
    throw new Error('Request failed!');
  }, networkError => {
    console.log(networkError.message)
  })
}


function runTheApp()
{   
    console.log('Starting the Betfair Horse Racing API App!\n');
    console.log(listEventTypes());
}

runTheApp();

也许可以在获取选项中将数据键重命名为body。这似乎有效,非常感谢