空手道中的空手道框架符号编码 [英] Karate framework symbol encoding in url

查看:97
本文介绍了空手道中的空手道框架符号编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个:

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

Scenario:
    Given path 'publish'

这里的问题是该网址被解析为:

Problem here is that the url is being resolved as:

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

代替:

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

谢谢

我会改善这个问题.

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

I uploaded a very simple project here: https://github.com/italktothewind/karate-encoding

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

此功能有效:

Feature: Working example

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

但是此功能不起作用(我在项目中放置了@ignore标志,以便可以成功构建它):

But this feature is not working (I put an @ignore flag in the project so it can be built successfully):

Feature: Non working example

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

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

这两个功能之间的区别是使用urlpath.

The difference between the two features is the use of 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):

when you have un-conventional URL-s the general recommendation in Karate is to use only the url (don't use path): https://stackoverflow.com/a/53638335/143475

这篇关于空手道中的空手道框架符号编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆