title: Getting response code 401 causes skipping code blocks
body: <p>I'm writing an ionic v1/express/mongo/node app. When checking if the user is authenticated i have the following piece of code:</p>
  
  <pre><code>checkAuthentication: function(token) {
              console.log(token);
              return $http.get("http://validUrl/test", {
                  headers: {
                      'testingAuth': token
                  }
              }).then(function(result) {
                  return result.data;
              });
          }
  </code></pre>
  
  <p>and am calling it like this:</p>
  
  <pre><code>checkAuthentication(token).then(function(response) {
              console.log("testing response: " + response);
              // if a valid token is already in storage = response contains "Success"(?), just $state.go to main page, else call the login() function
              if (response.content === "Success") {
                  // $state.go main page
              } else {
                  console.log("could not log in");
              }
          })
  </code></pre>
  
  <p>The problem is, when I get back code 401 from the server, I somehow skip the then block in the checkAuthentication function. Execution doesn't stop at a breakpoint at "return result.data", or "console.log("could not log").</p>
  
  <p>Am I doing something obviously wrong? Is there something i need to do to force going into that block? Thanks for any advice.</p>