我无法在EdgeHTML 17中使用URLSearchParams发布表单数据。有谁知道最新更新的任何问题?
我使用以下NPM软件包作为旧浏览器的polyfills:
以下是我正在使用的代码:
fetch("/api/checkout", { method: 'POST', headers: new Headers({
"X-Requested-With": "FetchAPI",
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
}), credentials: 'include', body: new URLSearchParams($("#MyForm").serialize()) })
.then((msg) => {
return msg.json();
}).then((data) => {
console.log(data);
});
答案 0 :(得分:1)
似乎edge不再自动在主体上执行toString了。通过将.toString()
添加到正文中,它应该可以工作。