This is the code that works just fine:
require 'sinatra'
post '/foo' do
"Equals to #{params[:a]}!"
end
If I send POST
request, it returns all right:
$ ruby foo.rb -p 8888
$ curl -X POST -H 'Content-Length: 5' --data 'a=444' http://localhost:8888/foo
Equals to 444!
Now, I modify the code:
require 'sinatra'
use Rack::RewindableInput::Middleware
post '/foo' do
"Equals to #{params[:a]}!"
end
I’m getting this:
$ ruby foo.rb -p 8888
$ curl -X POST -H 'Content-Length: 5' --data 'a=444' http://localhost:8888/foo
Equals to !
What am I doing wrong?