我在控制器中打印参数
如何转换为原始http请求,例如
http://SERVER/queries?product_type="IF"..
{
"market" => "cffex_hfts",
"product_type" => "IF",
"frequency" => "minute",
"contract_month" => "2014-03-01 00:00:00",
"start_at" => "2014-01-10 01:26:00",
"end_at" => "2014-01-10 08:26:00",
"controller" => "queries",
"action" => "index"
}
答案 0 :(得分:1)
params = {
"market" => "cffex_hfts",
"product_type" => "IF",
"frequency" => "minute",
"contract_month" => "2014-03-01 00:00:00",
"start_at" => "2014-01-10 01:26:00",
"end_at" => "2014-01-10 08:26:00",
"controller" => "queries",
"action" => "index"
}
params.to_query
=> "action=index&contract_month=2014-03-01+00%3A00%3A00&controller=queries&end_at=2014-01-10+08%3A26%3A00&frequency=minute&market=cffex_hfts&product_type=IF&start_at=2014-01-10+01%3A26%3A00"