Re: [whatwg/fetch] fetch() doesn't properly handle errors from pre-flight responses with CORS (#443)

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