Answer the question
In order to leave comments, you need to log in
How to change CORS?
There is an API and Lambda on AWS, I created a small script, uploaded it to the hosting. In him:
...
let response = fetch(url, {
mode: 'no-cors',
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(body)
})
.then( data => {
return data.json();
})
.then( data => {
console.log(data);
});
...
...
return {
'statusCode': 200,
'headers': {
"Access-Control-Allow-Headers": "Content-Type",
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Credentials" : True,
'Access-Control-Allow-Methods': 'POST,GET'
},
'body': body
}
...
Uncaught (in promise) SyntaxError: Unexpected end of input
at script.js:19
Answer the question
In order to leave comments, you need to log in
And what comes in data ? Maybe it doesn't have a json method
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question