CopyPastor

Detecting plagiarism made easy.

Score: 0.8139645908525598; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2022-08-08
by Shreya Patel

Original Post

Original - Posted on 2022-06-07
by Ali Murtaza



            
Present in both answers; Present only in the new answer; Present only in the old answer;

This is a CORS (cross-origin resource sharing) issue and you do not have to delete/modify anything. You just have to enable the CORS request from your server-side and it will work fine.
const Map<String, String> corsHeaders = { 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'GET, POST, DELETE, PUT, PATCH, OPTIONS', 'Access-Control-Allow-Headers': '*', }
Please add this headers on API end.
This is a CORS (cross-origin resource sharing) issue and you do not have to delete/modify anything. You just have to enable the CORS request from your server-side and it will work fine.
In my case, I have created a server with node.js and express.js, so I just added this middleware function that will run for every request.
```javascript app.use(function(req, res, next) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Methods", "GET,PUT,PATCH,POST,DELETE"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); next(); }); ```
And BOOOOM! I received the data.
You just have to look at the settings to enable CORS for your server.

        
Present in both answers; Present only in the new answer; Present only in the old answer;