📜  [未处理的承诺拒绝:TypeError:GET 或 HEAD 请求不允许正文] - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:29.490000             🧑  作者: Mango

代码示例1
// Please note that you cannot use body in GET Request. Please change it to POST.

var url = new URL("https://apitest.kuveytturk.com.tr/prep/v1/data/fecs"),
    params = {firstParam: 'isoCode ',
               secondParam: 'internationalCode',
               thirdParam: 'name',
               fourthParam: 'code',
               FifthParam: 'group',
               SixthParam: 'id'}
Object.keys(params).forEach(key => url.searchParams.append(key, params[key]))
fetch(url).then(/* … */)