options = {
"accesscode" => Settings.opensocial_code,
"method" => "statuses_update",
"data" => gen_content_data(content, fan).to_json
}
result = post(:GWService,{}, options)
我用 ActiveResource 向 java 的程序 post 了一些数据,
我在 lib/actove_resource/connection.rb 设了断点
def post(path, body = '', headers = {})
with_auth { request(:post, path, body.to_s, build_request_headers(headers, :post, self.site.merge(path))) }
end
打印出发送的 body 的值为
{:accesscode=>"93f348fcdfsfse4a38a927b282c94",
:method=>"statuses_update",
:data=>
{:webType=>"sina",
:apiToken=>"2.00jT5OoBIMceNCf6a1f942f10eW_zz",
:clientId=>"2034037976",
:openId=>"",
:content=>"测试测试"}}
但是 对方用 request params 那不到数据,但是用 InputStream in=request.getInputStream(); 这样才能拿到 下面的数据
{"accesscode"=>"93f348fcdfsfse4a38a927b282c94", "method"=>"statuses_update", "data"=>"{\"webType\":\"sina\",\"apiToken\":\"2.00jT5OoBIMceNCf6a1f942f10eW_zz\",\"clientId\":\"2034037976\",\"openId\":\"\",\"content\":\"测试测试\"}"}
这是什么问题?