空手道API测试-转义“?"在功能文件中的网址中 [英] Karate API Tests - Escaping '?' in the url in a feature file
本文介绍了空手道API测试-转义“?"在功能文件中的网址中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Karate API框架中的 path 关键字来连接字符串以形成url.但是,我无法通过?".这是我在做什么:
I am using the path keyword from Karate API framework to concatenate strings to form a url. However, I am not able to pass '?'. Here is what I am doing:
Background:
* url 'https://api.cloud.abcde.com/animal/'
Scenario: Verify the get status
Given path 'herbivore?id=25'
When method get
Then status 200
运行测试时,我看到?"作为%3F被传递.我尝试使用\对其进行转义,并尝试了其他一些答案,但未能成功.我需要使用url编码吗?任何指针或帮助,将不胜感激. 谢谢
When I run the test, i see the '?' being passed as %3F. I tried to escape it using \ and tried some other answers too but couldn't succeed. Do I need to use url encoding ? Any pointers or help would be appreciated. Thanks
推荐答案
在这种情况下,您应该使用param
:
You should use param
for this case:
Scenario: Verify the get status
Given path 'herbivore'
And param id = 25
When method get
Then status 200
这篇关于空手道API测试-转义“?"在功能文件中的网址中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文