Padrino/Sinatra Rack-Test POST does not fill in params

565 Views Asked by At

I'm trying to use Rack-Test to issue a post request to my padrino app:

post '/sms', "name" => "Bryan"

My route looks like this:

post :index do
  puts params.inspect
  puts rack_input.inspect
end

rack_input is a method I wrote to parse the raw rack input. When I run the test, I get this output:

{}
"name=Bryan"

However, when I use curl on the command line, it works fine:

curl -d "name=Bryan" localhost:8080/sms

{"name"=>"Bryan"}
"name=Bryan"

What am I doing wrong?

1

There are 1 best solutions below

1
On

Try with symbols:

post '/sms', :name => "Bryan"