无法根据需要转义网址 [英] Cannot escape url as needed
本文介绍了无法根据需要转义网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想逃避路径中的某些值.
I am tring to escape some values in a path.
假设我正在尝试获取https://www.google.com/https%3A%2F%2Fdomain
我尝试了以下选项:
Scenario: escape value
* url "https://www.google.com"
* path "https://domain"
When method get
* path "https\:\/\/domain"
When method get
* path "https%3A%2F%2Fdomain"
When method get
* path "https\\:\\/\\/domain"
When method get
但是我得到
-
https://www.google.com/https://domain
-
https://www.google.com/https://domain
-
https://www.google.com/https%253A%252F%252Fdomain
https://www.google.com/https://domain
https://www.google.com/https://domain
https://www.google.com/https%253A%252F%252Fdomain
为什么%2F
被转义到%252F
时为什么\
不起作用?
Why is \
not working, while %2F
is being escaped into %252F
?
推荐答案
编码是正确的行为: https://www.w3schools.com/tags/ref_urlencode.asp
但是您可以在空手道中找到此异常URL的解决方法,使其成为url
本身的一部分:
But your workaround for this un-usual URL is in Karate make it as part of the url
itself:
Given url 'https://httpbin.org/https%3A%2F%2Fdomain'
When method get
Then status 200
这篇关于无法根据需要转义网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文