简体   繁体   中英

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

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?

尝试使用符号:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM