可能我遗漏了一些东西,试图在使用XML的react应用程序中运行fetch请求,邮递员请求正在成功传递,但返回返回404。示例:
const body = '<?xml version="1.0" encoding="UTF-8"?><OFX><SIGNONMSGSRQV1>...some body </SIGNUPMSGSRQV1></OFX>';
const url = '10.10.10.110'// fake address
fetch(url, {
method: "POST",
mode: 'cors',
body: body,
headers: {
'Content-Type': 'application/x-ofx'
}
}).then((res)=>{
console.log(res.status);
}).catch((err) => {
console.log('Err', err);
})
身体:JSON.stringify(身体)给予同样的404;
发布于 2018-04-27 08:28:41
找出使用fetch问题id头发送请求的方法。不能在标头中发送ofx
const body = `<OFX>...request body...</OFX>`;
const url = 'http://requestserver';
return fetch(url, {
method: "POST",
body: body,
mode: 'cors',
headers: {
'Content-Type': 'text/plain;charset=UTF-8"'
}
https://stackoverflow.com/questions/49906210
复制相似问题