isomorphic-fetch: не удалось получить
Когда я открываю запрос POST, он плохо работает, что не так с моим кодом?
Btw. Я отправляю запрос POST, но сервер получил запрос OPTIONS.
try{
const URL = config.LOGIN;
const data = await fetch(URL,{
method:"POST",
headers:{
"Accept": "application/json",
"Content-Type": "application/json"
},
body:JSON.stringify({
"a":1,
"b":2
})
}).then((response)=>{
return response.json();
});
console.log(data)
}catch(e){
// TypeError: Failed to fetch
alert(e)
}
И браузер сообщает об ошибке: 405: метод не разрешен
GET- запрос работает нормально
const data = await fetch(URL).then((res)=>{
return res.json()
});
Клиент:
405: Method Not Allowed
TypeError: Failed to fetch
Сервер:
[W 170505 14:20:00 web:1971] 405 OPTIONS /shundai/CoffeeManagementLogin (192.168.2.114) 1.00ms
Спасибо!