I'm using node.js with React and am trying to use fetch function to call a data from a server with CORS support.
However when I'm trying to set custom User-Agent it's returning a null value.
fetchData(){
let url = 'http://localhost:8080/testData';
var headers = new Headers();
headers.set('user-agent', 'test_UA');
var options = {
method: 'GET',
mode: 'cors',
headers: headers
};
var request = new Request(url, options);
console.log(request.headers.get('User-Agent'));
}
Is there something I'm doing wrong?
via Aesis
No comments:
Post a Comment