【问题标题】:Karate 0.9.6 to 1.0.1 upgrade issue with array param阵列参数的空手道 0.9.6 到 1.0.1 升级问题
【发布时间】:2021-08-26 00:13:19
【问题描述】:

在空手道中发送空数组参数时,不会发送参数。

例子:

Given url homeUrl
And path 'types'
And param filterTypes = []
When method GET
Then status 200
And mach response = '#[0]'

在调试模式下运行空手道我看到以下获取请求

在 0.9.6 版中

GET https://{homeUrl}/types?filterTypes=%5B%5D

在 1.0.1 版中

GET https://{homeUrl}/types?

【问题讨论】:

  • 您介意将以前的问题答案标记为accepted 吗?谢谢:stackoverflow.com/a/67162707/143475
  • 好的,现在更新了。会是这个问题的类似答案吗?
  • 好的,我已经回答了这个问题。

标签: karate


【解决方案1】:

只需使用一个字符串。下面这四行将在 1.1.0 上运行,你自己试试看。

* url 'https://httpbin.org/get'
* param foo = '[]'
* method get
* status 200
* match response.url == 'https://httpbin.org/get?foo=[]'

这是日志中的请求:

1 > GET https://httpbin.org/get?foo=%5B%5D
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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-05-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多