title: Empty or too short HTTP message using HTTPRequest
body: <p>I have an app that responds to a POST request with files: </p>
  
  <p><a href="https://docxgenjs.herokuapp.com/" rel="nofollow">https://docxgenjs.herokuapp.com/</a></p>
  
  <p>It just echoes out (in JSON format) the files that were posted to that URL.</p>
  
  <p>You can test it using a REST Console (on chrome web store).</p>
  
  <p>Howewer, when I request that page using PHP, it doesn't work out:</p>
  
  <pre><code>try { 
      $url = 'https://docxgenjs.herokuapp.com/';
      $request = new HTTPRequest($url, HTTP_METH_POST); 
      $request-&gt;addPostFile("config",app_path()."\\docxgen\\config.json"); 
      $request-&gt;addPostFile("docx",app_path()."\\docxgen\\tagExample.docx"); 
      $request-&gt;send();
      $response = $request-&gt;getResponseBody();
      var_dump($response);
  } 
  catch(Exception $e) 
  {
      var_dump($e-&gt;getMessage()); var_dump($e-&gt;getCode());
  }
  </code></pre>
  
  <p>I get the following exception: </p>
  
  <pre><code>string(35) "Empty or too short HTTP message: ''"
  int(2)                                          
  </code></pre>
  
  <p>What's different between the two POST Requests, and how can I fix that ?</p>
  
  <p>If I remove the two lines:</p>
  
  <pre><code>$request-&gt;addPostFile("config",app_path()."\\docxgen\\config.json"); 
  $request-&gt;addPostFile("docx",app_path()."\\docxgen\\tagExample.docx"); 
  </code></pre>
  
  <p>They is no exception and the response of the server is the expected response <code>{}</code></p>