I am trying to send a file to the server using aurelia-fetch-client
, but get the following error in the browser console. No 'Access-Control-Allow-Origin' header is present on the requested resource.
, but when I do the same with XMLHttpRequest
file is uploaded.
Aurelia Fetch Client configuration and usage code
activate() {
await fetch;
this.http = this.httpClient();
this.http.configure(config => {
config
.useStandardConfiguration()
.withBaseUrl('http://localhost:3000')
});
}
makeRequest(data) {
this.http.fetch('upload', {
headers: {
'Content-Type': 'multipart/form-data'
},
method: 'post',
body: data
});
}