require 'HTTParty'
require 'json'
@payload ={
"email" => "phil@gmail.com",
"token" => "mytokenstuff",
"content" => "here is some content",
"notification_type" => "1",
"name" => "here is a name",
"auto_action" => "true"
}
response = HTTParty.post('http://localhost:3000/api/create.json', :body =>JSON.dump(@payload), :headers => { 'Content-Type' => 'application/json' } )
在我的 rails 控制器中,标题来自 ContentType text/html。所以很明显我的标题参数不起作用....
想法?