I am using the fetchClient to fetch results from a perl script on another domain.
If I don’t do custom headers, I get a CORS error. This is completely reasonable, so I tried to set up custom headers like so:
(based on this link: https://github.com/aurelia/fetch-client/issues/8)
self.httpClient.configure(config => {
config.withDefaults({
headers: {
'Access-Control-Allow-Origin': '*',
},
mode : 'no-cors',
})
});
When I do this, I get Unexpected end of input
as an error.
I have also tried:
self.httpClient.configure(config => {
config.withDefaults({
headers: {
'Access-Control-Allow-Origin': '*',
'mode' : 'no-cors',
},
})
});
and also:
self.httpClient.configure(config => {
config.withDefaults({
headers: {
'Access-Control-Allow-Origin': '*',
},
'mode' : 'no-cors',
})
});
If I comment out the headers, I get the CORS error, but eventually it goes away.
My questions are:
- How do I configure the headers properly?
- Why is the CORS error going away without me configuring the headers?
Thanks in advance.