空手道做对了。您可以使用这个 3 线空手道测试来亲眼看看:
* url 'https://httpbin.org/anything'
* form field foo = 'one/two?three=four'
* method post
您可以看到“原始”请求是:
1 > POST https://httpbin.org/anything
1 > Content-Type: application/x-www-form-urlencoded
1 > Content-Length: 28
1 > Host: httpbin.org
1 > Connection: Keep-Alive
1 > User-Agent: Apache-HttpClient/4.5.13 (Java/11.0.11)
1 > Accept-Encoding: gzip,deflate
foo=one%2Ftwo%3Fthree%3Dfour
但在响应中,您可以看到服务器正确处理了它:
1 < 200
1 < Date: Wed, 06 Oct 2021 12:06:10 GMT
1 < Content-Type: application/json
1 < Content-Length: 513
1 < Connection: keep-alive
1 < Server: gunicorn/19.9.0
1 < Access-Control-Allow-Origin: *
1 < Access-Control-Allow-Credentials: true
{
"args": {},
"data": "",
"files": {},
"form": {
"foo": "one/two?three=four"
},
"headers": {
"Accept-Encoding": "gzip,deflate",
"Content-Length": "28",
"Content-Type": "application/x-www-form-urlencoded",
"Host": "httpbin.org",
"User-Agent": "Apache-HttpClient/4.5.13 (Java/11.0.11)",
"X-Amzn-Trace-Id": "Root=1-615d9132-260dcbf96f57a6992b6273dc"
},
"json": null,
"method": "POST",
"origin": "122.179.54.225",
"url": "https://httpbin.org/anything"
}
查看响应中名为 form 的 JSON 字段。
我认为您应该做一些研究,或与您的“服务器”团队交谈。谁知道呢,也许空手道已经为你找到了一个错误。