Unhandled Rejection (SyntaxError): Unexpected end of input
Всем привет. ПОСТ запрос к АПИ с помощью Фетч
getResource = async () => {
const res = await fetch('https://fan-foto-ml753mfuuq-uc.a.run.app/api/v1/login/access-token', {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded',
'Access-Control-Allow-Methods': 'GET, PUT, POST, DELETE, HEAD, OPTIONS'
// 'Authorization': 'Bearer TOKEN',
},
method: 'POST',
mode: 'no-cors',
credentials: 'include',
body: 'grant_type=&username=charles%40mavencodom&password=test&scope=&client_id=&client_secret='
});
// if (!res.ok) {
// throw new Error(`Not Fetch, received ${res.status}`)
// }
const body = await res.json();
return body;
};
Получаю Unhandled Rejection (SyntaxError): Unexpected end of input Eсли раскометировать if, то получаю Not Fetch, received 0 Статус запроса при этом 200, но ответа нет. ПОдскажите, пожалуйста что не так.