在实际的GET调用中使用(null)还是省略了key,需要想办法发送null值
Using (null) still omits the key in the actual GET call, need to find a way to send a null value
我有以下设置:
* table requestTable
| q | um | ie | status |
| (null) | 1 | utf | 400 |
* call read('called.feature') requestTable
而 called.feature
看起来像这样:
* def requiredParams = { q: '#(q)', um: '#(um)', ie: '#(ie)'}
url 'https://httpbin.org/anything'
params requiredParams
method GET
调用失败。但是,不是出于我想要的原因。 “q”键从实际的 GET 调用中删除。我需要它在实际请求中通过:“q=”。所以请求应该是这样的:
https://httpbin.org/anything/q=&um=1&ie=utf
请指教
给你。花点时间理解 table
中字符串之间的区别——它们必须是变量或在引号内(就像 JS)。
您错过的解决方案是您需要一个空字符串,而不是 null
- 这将从请求中删除整个 param
。
Feature:
Scenario:
* table requestTable
| q | um | ie | status |
| '' | 1 | 'utf' | 400 |
* call read('called.feature') requestTable
而called.feature
是:
@ignore
Feature:
Scenario:
* def requiredParams = { q: '#(q)', um: '#(um)', ie: '#(ie)' }
* url 'https://httpbin.org/anything'
* params requiredParams
* method get
提出的要求是:
1 > GET https://httpbin.org/anything?q=&um=1&ie=utf
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
我有以下设置:
* table requestTable
| q | um | ie | status |
| (null) | 1 | utf | 400 |
* call read('called.feature') requestTable
而 called.feature
看起来像这样:
* def requiredParams = { q: '#(q)', um: '#(um)', ie: '#(ie)'}
url 'https://httpbin.org/anything'
params requiredParams
method GET
调用失败。但是,不是出于我想要的原因。 “q”键从实际的 GET 调用中删除。我需要它在实际请求中通过:“q=”。所以请求应该是这样的:
https://httpbin.org/anything/q=&um=1&ie=utf
请指教
给你。花点时间理解 table
中字符串之间的区别——它们必须是变量或在引号内(就像 JS)。
您错过的解决方案是您需要一个空字符串,而不是 null
- 这将从请求中删除整个 param
。
Feature:
Scenario:
* table requestTable
| q | um | ie | status |
| '' | 1 | 'utf' | 400 |
* call read('called.feature') requestTable
而called.feature
是:
@ignore
Feature:
Scenario:
* def requiredParams = { q: '#(q)', um: '#(um)', ie: '#(ie)' }
* url 'https://httpbin.org/anything'
* params requiredParams
* method get
提出的要求是:
1 > GET https://httpbin.org/anything?q=&um=1&ie=utf
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