Karate API Tests - Escaping '?' in the url

2019-04-14 01:53发布

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

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

1条回答
劫难
2楼-- · 2019-04-14 02:20

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
查看更多
登录 后发表回答