title: How reliable is HttpStatusCodeResult.StatusDescription?
body: <p>Consider the following controller action, of which plenty examples exist around the web:</p>
  
  <pre><code>public ActionResult Fail()
  {
      return new HttpStatusCodeResult(HttpStatusCode.BadRequest, "My helpful message");
  }
  </code></pre>
  
  <p>Now, we'll call that action via Ajax and display the results in the page;</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
      &lt;head&gt;
          &lt;title&gt;&lt;/title&gt;
          &lt;script type="text/javascript"&gt;
              var xmlhttp = new XMLHttpRequest();
  
              xmlhttp.onreadystatechange = function () {
                  if (xmlhttp.readyState == 4) {
                      document.body.innerHTML = xmlhttp.response;
                  }
              }
  
              xmlhttp.open("POST", "/log/fail", true);
              xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
              xmlhttp.send();
  
          &lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>When I open that page in say Chrome or Firefox on my Windows 10 device, I get a full error report with <em>My helpful message</em> displayed prominently.</p>
  
  <p>However, when I open this page on an iOS device (tested with iPad Air, iPhone 5S), the message is nowhere in the received response.</p>
  
  <p>This leads me to believe that you can't depend on <code>HttpStatusCodeResult.StatusDescription</code> to be returned to the client and rather than detecting an application issue and responding with a <code>new HttpStatusCodeResult()</code>, instead, models sent back to the front end should be extended to include any application-specific error messages and sent back normally (<code>HttpStatusCode.OK</code>).  Is this the case?</p>
  
  <p>Note that this extends to AngularJs where I originally found it, and jQuery as well;</p>
  
  <p><strong>AngularJS</strong></p>
  
  <pre><code>$http.post('/log/fail')
      .then(function (response) {
          // successful
      }, function (response) {
          document.body.innerHTML = response.statusText; // 'Bad Request' in iOS
      });
  </code></pre>
  
  <p><strong>jQuery</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
      &lt;head&gt;
          &lt;title&gt;&lt;/title&gt;
          &lt;script src="https://code.jquery.com/jquery-2.1.4.min.js"&gt;&lt;/script&gt;
          &lt;script type="text/javascript"&gt;
              $.ajax({ url: '/log/fail', method:'POST' }).error(function (response) {
                  document.body.innerHTML = response.statusText; // 'Bad request' in iOS
              });
          &lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>