this is my service file code.
getSearchValue() {
let headers = new HttpHeaders({
'Accept': 'application/json',
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': 'Content-Type',
'Access-Control-Allow-Methods': 'GET,POST,OPTIONS,DELETE,PUT',
'Authorization': 'Bearer Key[enter image description here][1]',
});
let options = { headers: headers };
return this.http.get(this.baseUrl, options)
}
//this is my service file code. i have fetch the data using online api showing the cors issue
There's very few cases were you should manually add any CORS related headers when making a request to a server. All of the
Access-Control-Allow-*
prefixed headers you've added to your request are actually response headers that should be returned by the server.