title: Upload Binary file with HttpClient using octet stream
body: <p>I am trying to upload a file using an httpClient as an octet-stream</p>
  
  <ol>
  <li>Following documentation is provided</li>
  <li>HTTP Verb => POST</li>
  <li>Content–Type => application/octet-stream</li>
  <li>Accept => application/json</li>
  <li>Authorization => Bearer {access token}</li>
  <li>x-file-name => Test file.pdf</li>
  <li>x-convert-document (optional) => true</li>
  <li>x-source => the source (can be any string)</li>
  <li>Request Body => file (binary Stream)</li>
  </ol>
  
  <p>Side note : in my code below the Accept and Bearer headers and their values are already present in the Client I am fetching with the "await GetRestClientAsync()"</p>
  
  <p>I expect a response back, but for now I am getting nothing back the application just stops, what am I doing wrong here?</p>
  
  <p>Ps: Other Posts, request towards this api work fine with the same client I use here, so it's most likely that I am messing something up with the MultiPartFormDataContent
  </p>
  
  <pre><code> protected async Task&lt;TResponse&gt; ExecutePostAsBinaryCustomHeadersAsync&lt;TResponse&gt;(Uri apiUri, Stream fileStream, string fileName ,bool returnDefaultObjectForInternalServerError = false)
      {
          using (var formData = new MultipartFormDataContent())
          {
              formData.Add(new StringContent(fileName), "x-file-name");
              formData.Add(new StringContent("true"), "x-convert-document");
              formData.Add(new StringContent("Agion"), "x-source");
              formData.Add(new StringContent("application/octet-stream"), "Content-Type");
  
              using (var client = await GetRestClientAsync())
              {
                  StreamContent content = new StreamContent(fileStream);
                  formData.Add(content, "file", fileName);
  
                  using (var response = await client.PostAsync(apiUri, formData))
                  {
  
                      return await DeserializeResponseAsync&lt;TResponse&gt;(response, returnDefaultObjectForInternalServerError); 
                  }
  
              }
          }
      }
  </code></pre>