【发布时间】:2015-01-29 22:45:05
【问题描述】:
我正在使用 Sinatra 和 rest-client 发送 JSON 有效负载并对其进行处理(请求需要密钥对签名)。
但是看起来 rest-client 正在发送转义的 JSON。
我的 RestClient 日志:
RestClient.post uriHere, "{\"eventID\":1}", "Accept"=>"application/json", "Accept-Encoding"=>"gzip, deflate", "Authorization"=>"Bearer tokenHere", "Content-Hash"=>"sha1 signatureHere", "Content-Length"=>"xyz", "Content-Type"=>"application/json", "Date"=>"Thu, 29 Jan 2015 22:26:47 GMT"
我无法验证端点是否真的在读取转义字符,但如果它像那样发送它们,显然它不是有效的 JSON。我试过 .gsub 但它没有删除多余的斜线。
想法?
【问题讨论】:
标签: ruby json rest rest-client