我有一个perl应用程序,它生成如下的哈希:
'fields' => {
'site_id' => '7',
'orig_price_s' => [
'150.00'
],
'is_public_b' => [
1
],
'current_price_s' => [
'100.00'
],
'published_at_l' => [
1411030654
],
'expires_at_l' => [
1414814340
]
}
该哈希被转储到LWP :: UserAgent请求中,其内容如下所示:
_content: "--- \ndocument: \n
current_price_s: \n
- 100.00\n
expires_at_l: \n
- 1414814340\n
is_public_b: \n
- 1\n
orig_price_s: \n
- 150.00\n
published_at_l: \n
- 1411030731\n "
LWP :: UserAgent向Rails应用程序发出请求,Rails收到的请求从current_price_s和orig_price_s字段中删除了尾随零。像这样:
Params: {
"controller"=>"admin/documents",
"format"=>"json",
"site_id"=>"7",
"action"=>"create",
"document"=>{
"published_at_l"=>[1407739955],
"current_price_s"=>[31.0],
"expires_at_l"=>[4121650355],
"orig_price_s"=>[150.0]
}
}
我可以通过几种不同的方式解决它,但我的问题是......它为什么会发生?它是LWP :: UserAgent中的东西还是Rails请求解析器中的某些东西? 0 \ n被视为八进制,还是被视为“坏人物”?