title: rails send_data does not send anything when using POST to send Excel file
body: <p>When I call <code>send_data</code> at the end of a controller method to export an Excel file (using Axlsx), nothing happens IF the controller method was called using a POST. If the same controller method was called using a GET, <code>send_data</code> works perfectly fine. In both scenarios, the Excel file is slightly different (the POST sends data that determines how the data is displayed in Excel), but I have verified that <code>excel_file</code> is set up correctly when using POST. <strong>When calling the POST endpoint externally using Postman, the correct Excel file is downloaded. However, when clicking on the link in the browser that makes this POST request, <code>send_data</code> seems to do nothing.</strong> The controller method has two lines of code:</p>
  
  <pre><code>excel_file = excel_util.export(params[:myPostParams]
  send_data(excel_file.to_stream.read, type: "application/xlsx", filename: "MyExcelWorksheet.xlsx")
  </code></pre>
  
  <p>More information about my POST call:</p>
  
  <p>I am calling the POST from an element on my view using JQuery ($.post method). Like I mentioned above, this seems to work perfectly fine because the POST call goes through passing the correct info in its body as <code>excel_file</code> is built correctly.</p>
  
  <p>Examining the Network in chrome's Developer Tools, using POST creates an 'export' action and a 'results' action. <code>export</code> is the name of the controller method that handles the POST and GET. Here is the info (only included relevant info, the host/origin/referrer links are all fine).</p>
  
  <p>'export' info:</p>
  
  <pre><code>Request URL: http://localhost:3000/&lt;myappname&gt;/export
  Request Method: POST
  
  Response Headers:
  Content-Disposition:attachment; filename="MyExcelWorksheet.xlsx"
  Content-Length:7648
  Content-Transfer-Encoding:binary
  Content-Type:application/xlsx
  X-Content-Type-Options:nosniff
  X-Frame-Options:SAMEORIGIN
  X-Miniprofiler-Ids:["i6c3..."]
  
  
  Request Headers:
  Accept:*/*
  Accept-Encoding:gzip, deflate, br
  Accept-Language:en-US,en;q=0.8
  Connection:keep-alive
  Content-Length:1803
  Content-Type:application/x-www-form-urlencoded; charset=UTF-8
  X-Requested-With:XMLHttpRequest
  
  Form Data:
  &lt;the data I send in the body of my POST&gt;
  </code></pre>
  
  <p>'results' info:</p>
  
  <pre><code>Request URL: http://localhost:3000/mini-profiler-resources/results
  Request Method: POST
  
  Response Headers:
  Content-Type:application/json
  
  Request Headers:
  Accept:application/json, text/javascript, */*; q=0.01
  Accept-Encoding:gzip, deflate, br
  Accept-Language:en-US,en;q=0.8
  Connection:keep-alive
  Content-Length:64
  Content-Type:application/x-www-form-urlencoded; charset=UTF-8
  X-Requested-With:XMLHttpRequest
  
  Form Data:
  id: &lt;i6c3... &lt; same as the X-Miniprofiler-Id shown above &gt;
  popup: 1
  </code></pre>
  
  <p>Is there an issue with rails letting POST requests respond with attachment downloads in the browser? This works when calling API externally, but not when using it in the browser.</p>