title: How to open a CSV file generated by POST
body: <p>I am trying to implement these seemingly simple requirements but can't find a way :</p>
  
  <ul>
  <li>Single Page App using Angular JS</li>
  <li>REST(ish) back end</li>
  <li>Back end resource exposed via POST request</li>
  <li><strong>Resource parameters passed as JSON in the request body</strong></li>
  <li>Resource produces a CSV file</li>
  <li>When a user clicks a button, generate a request with the right JSON parameters in the body, send it, and allow user to download the response as a file (prompts the browser's "open / save as" dialog)</li>
  </ul>
  
  <p>The problem is mainly, how to pass the JSON as request body? The most common technique seems to be the hidden HTML form to trigger the download, but an HTML form cannot send JSON data in the body. And I can't find any way to trigger a download dialog using an XMLHttpRequest...</p>
  
  <p>Any ideas?</p>
  
  <p>I specified Angular but any generic JS solution is very welcome too!</p>