title: How to send raw post data in a Rails functional test?
body: <p>I'm looking to send raw post data (e.g. unparamaterized JSON) to one of my controllers for testing:</p>
  
  <pre><code>class LegacyOrderUpdateControllerTest &lt; ActionController::TestCase
    test "sending json" do
      post :index, '{"foo":"bar", "bool":true}'
    end
  end
  </code></pre>
  
  <p>but this gives me a <code>NoMethodError: undefined method `symbolize_keys' for #&lt;String:0x00000102cb6080&gt;</code> error.</p>
  
  <p>What is the correct way to send raw post data in <code>ActionController::TestCase</code>?</p>
  
  <p>Here is some controller code:</p>
  
  <pre><code>def index
    post_data = request.body.read
    req = JSON.parse(post_data)
  end
  </code></pre>