Karate 空手道api测试正在进行post调用时将@转换为%40
我已经使用空手道框架编写了一个api测试。在进行post调用时,它将电子邮件字段的值从TEST@ABC.COM要测试%40ABC.COM 这里有几行日志Karate 空手道api测试正在进行post调用时将@转换为%40,karate,Karate,我已经使用空手道框架编写了一个api测试。在进行post调用时,它将电子邮件字段的值从TEST@ABC.COM要测试%40ABC.COM 这里有几行日志 1 > Content-Type: application/x-www-form-urlencoded; charset=UTF-8 1 > User-Agent: Apache-HttpClient/4.5.5 (Java/1.8.0_221) email=TEST%40ABC.COM&checkDigit=&br
1 > Content-Type: application/x-www-form-urlencoded; charset=UTF-8
1 > User-Agent: Apache-HttpClient/4.5.5 (Java/1.8.0_221)
email=TEST%40ABC.COM&checkDigit=&brandName=
根据HTTP规范,这是正确的: 你可以自己看看,试试这个:
* url 'http://httpbin.org'
* path 'anything'
* form field username = 'john@smith.com'
* form field password = 'secret'
* method post
结果:
1 > Accept-Encoding: gzip,deflate
1 > Connection: Keep-Alive
1 > Content-Length: 41
1 > Content-Type: application/x-www-form-urlencoded; charset=UTF-8
1 > Host: httpbin.org
1 > User-Agent: Apache-HttpClient/4.5.12 (Java/1.8.0_231)
username=john%40smith.com&password=secret
但是当您看到响应时,您可以看到服务器正确地处理了它,请查看JSON中的表单
:
1 < 200
1 < Access-Control-Allow-Credentials: true
1 < Access-Control-Allow-Origin: *
1 < Connection: keep-alive
1 < Content-Length: 555
1 < Content-Type: application/json
1 < Date: Tue, 07 Apr 2020 13:11:58 GMT
1 < Server: gunicorn/19.9.0
{
"args": {},
"data": "",
"files": {},
"form": {
"password": "secret",
"username": "john@smith.com"
},
"headers": {
"Accept-Encoding": "gzip,deflate",
"Content-Length": "41",
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
"Host": "httpbin.org",
"User-Agent": "Apache-HttpClient/4.5.12 (Java/1.8.0_231)",
"X-Amzn-Trace-Id": "Root=1-5e8c7c1e-affe121cae9f4b20399b0884"
},
"json": null,
"method": "POST",
"origin": "49.206.10.30",
"url": "http://httpbin.org/anything"
}
1<200
1<访问控制允许凭据:true
1<访问控制允许原点:*
1<连接:保持活动
1<内容长度:555
1<内容类型:应用程序/json
日期:2020年4月7日星期二13:11:58 GMT
1<服务器:gunicorn/19.9.0
{
“args”:{},
“数据”:“,
“文件”:{},
“表格”:{
“密码”:“秘密”,
“用户名”:”john@smith.com"
},
“标题”:{
“接受编码”:“gzip,deflate”,
“内容长度”:“41”,
“内容类型”:“application/x-www-form-urlencoded;charset=UTF-8”,
“主机”:“httpbin.org”,
“用户代理”:“Apache HttpClient/4.5.12(Java/1.8.0_231)”,
“X-Amzn-Trace-Id”:“根=1-5e8c7c1e-CAE9F4B20399B0884”
},
“json”:null,
“方法”:“发布”,
“来源”:“49.206.10.30”,
“url”:”http://httpbin.org/anything"
}
%40在HTML编码方案中编码时相当于@。你用什么语言?