title: Throwing HttpResponseException in WebAPI action method returning empty 200 response
body: <p>I'm trying to return appropriate Http codes and responses from my application but I am struggling. It seems that there are 2 ways to return specific http responses.</p>
  
  <p>The way I want to deal with it is by throwing a <code>HttpResponseException</code>:</p>
  
  <pre><code>public Information Get(int apiKey)
  {
      if (!_users.Authenticate(apiKey))
      {
          var response = new HttpResponseMessage();
          response.StatusCode = (HttpStatusCode)401;
          response.ReasonPhrase = "ApiKey invalid";
  
          throw new HttpResponseException(response);
      }
  
      return _info.Get();
  }
  </code></pre>
  
  <p>However, when I do this the response I see is just an empty 200 response!</p>
  
  <p>It also seems that you can also change the signature of your action method to return a <code>HttpResponseMessage</code> like this:</p>
  
  <pre><code>public HttpResponseMessage Get()
  {
      if (!_users.Authenticate(apiKey))
      {
          return Request.CreateResponse((HttpStatusCode) 401, "ApiKey invalid");
      }
  
      return Request.CreateResponse((HttpStatusCode) 200, _info.Get());
  }
  </code></pre>
  
  <p>I really don't want to do this if I can help it, I would much rather have my return type as the object I am trying to retrieve rather than wrapping it every time in a <code>HttpResponseMessage</code>.</p>
  
  <p>Is there a reason why the first method is returning an empty 200 rather than the 401 with the message as I want it to?</p>