Skip to content

Tag: fetch-api

React js fetch API

I am learning React.js and trying to fetch API like this and this is the error I get http://prntscr.com/k36ggq I am pretty new in this, so if anyone can help me with this that would be great. Thanks Answer Try by setting the header as follows. https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS You just re…

Fetch request to local file not working

I’m trying to make a request in a local file, but I don’t know when I try to do on my computer show me an error. Is possible make a fetch to a file inside your project? Answer I was encountering the same error and there are two changes I made in my code to get rid of the error.

CORS error, but data is fetched regardless

I have a generated React site I am hosting in an S3 bucket. One of my components attempts to fetch something when loaded: The url I am fetching is an AWS API Gateway. I have enabled CORS there, via the dropdown, with no changes to the default configuration. In my console, for both the remote site and locally …

fetch() unexpected end of input

I am using fetch() to grab data from api server. My error looks like this: Can you please tell me what am I doing wrong. Answer Opaque Responses A response for a no-cors request to a cross-origin resource has a response type of ‘opaque’. If you log the response before trying to turn it to JSON, yo…