Closed Tseberechts closed 8 years ago
Hi, In the readme there is a section on how to configure the fetch client. Can you please check if that isn't an answer for you? thanks cheers paul.
Hi Paul,
so this is what I do:
activate(){
this.fetchConfig.configure();
this.fetchConfig.httpClient.configure(config => {
config.
withDefaults({
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
})
});
}
then this is what my request looks like:
OPTIONS /auth/login HTTP/1.1
Host: [MY HOST NAME]
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
Access-Control-Request-Method: POST
Origin: [ORIGIN NAME]
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36
Access-Control-Request-Headers: accept, content-type
Accept: */*
DNT: 1
Referer: [MY REFERER]
Accept-Encoding: gzip, deflate, sdch
Accept-Language: nl-NL,nl;q=0.8,en-US;q=0.6,en;q=0.4,fr;q=0.2,af;q=0.2
I think the Accept
should be application/json
and there should be a Content-Type: application/json
.
Am I wrong?
cheers, Thomas
Very strange...
You are using isomorphic fetch?
Further investigation leads me to think it's a bug in the aurelia-fetch client. I'll post my issue there.
How can I get a header
'Content-Type': 'application/json'
when logging in with an object?When I do this, no Content-Type header is sent, I really need this, otherwise my request will fail.
Edit: typo