post 请求中的空手道多值
karate Multi-values in a post request
我在空手道中有以下场景:
Scenario:
Given url 'http://my-url.com'
And form field items = ['item1','item2']
When method post
这就是已处理的请求:
1 > POST http://my-url.com
1 > Content-Type: application/x-www-form-urlencoded
1 > Content-Length: 19
1 > Host: my-url.com
1 > Connection: Keep-Alive
1 > User-Agent: Apache-HttpClient/4.5.13 (Java/1.8.0_281)
1 > Accept-Encoding: gzip,deflate
items=item1%26item2
但实际上...我想要做的是以下请求:
1 > POST http://my-url.com
1 > Content-Type: application/x-www-form-urlencoded
1 > Content-Length: 19
1 > Host: my-url.com
1 > Connection: Keep-Alive
1 > User-Agent: Apache-HttpClient/4.5.13 (Java/1.8.0_281)
1 > Accept-Encoding: gzip,deflate
items=item1&items=item2
```
Is it possible with karate framework?
Thanks!
谢谢,您发现了我们正在跟踪的错误:https://github.com/karatelabs/karate/issues/1862
幸运的是,我认为您有解决方法。只需重复 field
项。让我知道这是否有效:
* url 'https://httpbin.org/anything'
* form field items = 'item1'
* form field items = 'item2'
* method post
我在空手道中有以下场景:
Scenario:
Given url 'http://my-url.com'
And form field items = ['item1','item2']
When method post
这就是已处理的请求:
1 > POST http://my-url.com
1 > Content-Type: application/x-www-form-urlencoded
1 > Content-Length: 19
1 > Host: my-url.com
1 > Connection: Keep-Alive
1 > User-Agent: Apache-HttpClient/4.5.13 (Java/1.8.0_281)
1 > Accept-Encoding: gzip,deflate
items=item1%26item2
但实际上...我想要做的是以下请求:
1 > POST http://my-url.com
1 > Content-Type: application/x-www-form-urlencoded
1 > Content-Length: 19
1 > Host: my-url.com
1 > Connection: Keep-Alive
1 > User-Agent: Apache-HttpClient/4.5.13 (Java/1.8.0_281)
1 > Accept-Encoding: gzip,deflate
items=item1&items=item2
```
Is it possible with karate framework?
Thanks!
谢谢,您发现了我们正在跟踪的错误:https://github.com/karatelabs/karate/issues/1862
幸运的是,我认为您有解决方法。只需重复 field
项。让我知道这是否有效:
* url 'https://httpbin.org/anything'
* form field items = 'item1'
* form field items = 'item2'
* method post