url 中的空手道框架符号编码

2024-03-18

我有这个:

Background:
    * url 'http://localhost:15672/api/exchanges/%2F/my_exchange'

Scenario:
    Given path 'publish'

这里的问题是 url 被解析为:

http://localhost:15672/api/exchanges///my_exchange/publish

代替:

http://localhost:15672/api/exchanges/%2F/my_exchange/publish

Thanks

EDITED:

我会改进这个问题。

我在这里上传了一个非常简单的项目:https://github.com/italktothewind/karate-encoding https://github.com/italktothewind/karate-encoding

它有一个 Wiremock 正在监听/bar/%2F/foo

此功能正在运行:

Feature: Working example

    Scenario:
        Given url 'http://localhost:1081/bar/%2F/foo'
        When method get
        Then status 200

但这个功能不起作用(我在项目中放置了一个@ignore标志,这样它就可以成功构建):

Feature: Non working example

Background:
    * url 'http://localhost:1081/bar/%2F'

Scenario:
    Given path 'foo'
    When get
    Then status 200

这两个功能的区别在于使用url and path.


对我有用:

* url 'https://httpbin.org/anything/%2F/my_exchange'
* method get

并在日志中:

1 > GET https://httpbin.org/anything/%2F/my_exchange
1 > Accept-Encoding: gzip,deflate
1 > Connection: Keep-Alive
1 > Host: httpbin.org
1 > User-Agent: Apache-HttpClient/4.5.11 (Java/1.8.0_231)

编辑:当您有非常规的 URL 时,空手道中的一般建议是仅使用url(不要使用path): https://stackoverflow.com/a/53638335/143475 https://stackoverflow.com/a/53638335/143475

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

url 中的空手道框架符号编码 的相关文章

随机推荐