title: HttpResponseMessage not returning ByteArrayContent - ASP.NET Core
body: <p>I have files stored in a database that I need a Web API to return. The database call correctly returns the proper byte array (Breakpoint shows the array being around 67000 in length, which is correct), but when I make a call to the Web API, I never get that content in the response. I've tried using a MemoryStream and ByteArrayContent, and neither give me the results I should be getting. I've tried calling from both Postman and my MVC application, but neither return the byte array, just the basic response information with headers/success/etc.</p>
  
  <pre><code>public HttpResponseMessage GetFile(int id)
  {
      var fileToDownload = getFileFromDatabase(id);
      if (fileToDownload == null)
      {
          return new HttpResponseMessage(HttpStatusCode.BadRequest);
      }
      var response = new HttpResponseMessage(HttpStatusCode.OK);
      response.Content = new ByteArrayContent(fileToDownload.FileData); //FileData is just a byte[] property in this class
      response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment");
      response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
      return response;
  }
  </code></pre>
  
  <p>Typical Response I get (with no byte content anywhere to be found):</p>
  
  <pre><code>{
    "version": {
      "major": 1,
      "minor": 1,
      "build": -1,
      "revision": -1,
      "majorRevision": -1,
      "minorRevision": -1
    },
    "content": {
      "headers": [
        {
          "key": "Content-Disposition",
          "value": [
            "attachment"
          ]
        },
        {
          "key": "Content-Type",
          "value": [
            "application/octet-stream"
          ]
        }
      ]
    },
    "statusCode": 200,
    "reasonPhrase": "OK",
    "headers": [],
    "requestMessage": null,
    "isSuccessStatusCode": true
  }
  </code></pre>
  
  <p>Maybe I'm misinterpreting how I should be handling this data, but I feel like this should be getting returned from the Web API call since I explicitly add it.</p>