- From: maic <notifications@github.com>
- Date: Tue, 14 Aug 2018 23:14:15 -0700
- To: whatwg/fetch <fetch@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Wednesday, 15 August 2018 06:14:37 UTC
It seems my mistake, but I don't know why...please help
```
// works fine
fetch('https://httpbin.org/post1', {mode: 'cors', json: JSON.stringify({aa: 11, bb: 22}), method: 'POST',})
.then(response => {
if (response.ok) {
return response.json()
} else {
return Promise.reject(response)
}
})
```
```
// cannot get responseļ¼error occurred. diff is `headers[Content-Type]=application/json`
fetch('https://httpbin.org/post1', {mode: 'cors', json: JSON.stringify({aa: 11, bb: 22}), method: 'POST', headers: {'Content-Type': 'application/json'}})
.then(response => {
if (response.ok) {
return response.json()
} else {
return Promise.reject(response)
}
})
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/443#issuecomment-413103966
Received on Wednesday, 15 August 2018 06:14:37 UTC