我最近学到了空手道,这是一个很棒的工作经历。我被困在一个问题上,并从不同的网站上寻找解决方案,但它没有帮助
场景:当方法POST然后状态302时,给定url "https://test.payu.in/_payment“和表单域surl = '/payu/web-response/17703721?appVersion=null&clientId=web-client/1.0‘
当我们点击上面的请求时,表单字段值被编码为'surl=%2Fpayu%2Fweb-response%2F17703721%3FappVersion%3Dnull%26clientId%3Dweb-client%2F1.0‘,因为这个请求失败了
如果你能给我提供解决方案,那将是非常有帮助的解决方案尝试: java.net.URLDecoder.decode('/payu/web-response/17703721?appVersion=null&clientId=web-client/1.0','UTF-8')
但没那么走运
发布于 2021-10-06 12:09:34
空手道是在做正确的事情。你可以使用这个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字段。
我认为你应该做一些研究,或者和你的“服务器”团队谈谈。谁知道呢,也许空手道给你找了个bug。
https://stackoverflow.com/questions/69465187
复制相似问题