CORS error

How do i resolve cors errors? Trying to post data into google sheets from my react app. I tested the api with postman and it works. I successfully post data with axios.post. But i always get a cors error when i try to post with the native fetch/Post method. Currently doing it in NextJS 13 App router APP. any help would be much appreciated.
2 Replies
Marti
Marti13mo ago
it might be a problem with your headers, iirc axios has some predefined headers already, but you have to manually include them for native fetch
{
"Content-Type": "application/json"
}
{
"Content-Type": "application/json"
}
try this on your headers
vedbew
vedbew12mo ago
Hi Marti, Thanks for responding. Will try the above method.
Want results from more Discord servers?
Add your server