您可能对 url 编码有问题。为此,您需要先对自动提交 URL 进行 URL 编码。
http://blog.flattr.net/2011/10/api-v2-beta-out-whats-changed/
变成http%3A%2F%2Fblog.flattr.net%2F2011%2F10%2Fapi-v2-beta-out-whats-changed%2F
然后,如果要将其作为常规 POST 请求发送,则需要对整个自动提交 URL 进行 URL 编码。
http://flattr.com/submit/auto?url=http%3A%2F%2Fblog.flattr.net%2F2011%2F10%2Fapi-v2-beta-out-whats-changed%2F&user_id=flattr
变成http%3A%2F%2Fflattr.com%2Fsubmit%2Fauto%3Furl%3Dhttp%253A%252F%252Fblog.flattr.net%252F2011%252F10%252Fapi-v2-beta-out-whats-changed%252F%26user_id%3Dflattr
.
如果要使用 JSON 发送它,则不需要对 flattr 自动提交 URL 进行 URL 编码。相反,您确实喜欢下面的示例。
{"url":"http://flattr.com/submit/auto?url=http%3A%2F%2Fblog.flattr.net%2F2011%2F10%2Fapi-v2-beta-out-whats-changed%2F&user_id=flattr"}
这意味着如果您执行常规 POST 请求,并且如果您仅将数据作为 JSON URL 编码发送一次,则部分 URL 将被 URL 编码两次。当您使用 JSON 正文执行 POST 请求时,您需要将其设置Content-Type
为application/json
使其工作。