title: can't get response status code with JavaScript fetch
body: <p>I'm trying to create a login form. when I'm testing the service with Postman, I will get a body object with status code and etc.</p>
  
  <p><a href="https://i.stack.imgur.com/pNbDh.png" rel="noreferrer"><img src="https://i.stack.imgur.com/pNbDh.png" alt="Postman Result"></a></p>
  
  <p>But, with JavaScript fetch, I can't get body object and I just received an error:</p>
  
  <p><a href="https://i.stack.imgur.com/W0jlR.png" rel="noreferrer"><img src="https://i.stack.imgur.com/W0jlR.png" alt="fetch console log"></a></p>
  
  <pre><code>export const login = (username,password) =&gt; {
      return dispatch=&gt;{
          const basicAuth = 'Basic ' + btoa(username + ':' + password);
          let myHeaders = new Headers();
              myHeaders.append('Authorization', basicAuth);
              myHeaders.append('Content-Type', 'application/json');      
              fetch(`${baseUrl}api/user/login`, {
                  withCredentials: true,
                  headers: myHeaders
              })
              .then(function (response) {
                  return response.json();
              })
              .then(function (json) {
                  dispatch(setLoginInfo(json))
              })
              .catch(err =&gt;{
                  console.log(err)
                   dispatch(loginFailed())
              });
      }
  
  }
  </code></pre>
  
  <p>I need to get status code in fetch.</p>