title: Rails functional test: sending URL query parameters in POST request
body: <p>I'm sending a POST request in a Rails functional test like this:</p>
  
  <pre><code>post :create, collection: { name: 'New Collection' }
  </code></pre>
  
  <p><code>collection</code> gets sent as JSON-encoded form data, as expected.</p>
  
  <p>What I can't figure out is how to add a query to the URL. <a href="http://guides.rubyonrails.org/testing.html#instance-variables-available">The documentation</a> says that I can access the request object and modify it before it gets sent. So I tried this:</p>
  
  <pre><code>@request.GET[:api_key] = 'my key'
  post :create, collection: { name: 'New Collection' }
  </code></pre>
  
  <p>But, <code>:api_key</code> never appears in the <code>request.GET</code> hash on the server. (It does when I send it though another HTTP client, though.)</p>