Reputation: 23737
I have a simple web application using twilio and sinatra.
Here it is:
# Responds to POSTs to http://yourapp.com/call
require 'rubygems'
require 'sinatra'
post '/call' do
to = params[:To]
puts to
"<Response><Say>Congratulations! You got through</Say></Response>"
end
The call gets through, but the "to" field that twilio sends in its request as a query parameter is not read. What am I doing wrong here?
Thanks
Upvotes: 1
Views: 458
Reputation: 3021
Try accessing the params hash with a stringified key. e.g.
to = params['To']
In Rails using a symbol would work because Rails extends the Rack params hash to have indifferent access. So in Rails, the following is true.
params['To'] == params[:To]
This can cause confusion when using other Rack frameworks.
Hope this helps.
S
Upvotes: 1