无法根据需要转义 url
Cannot escape url as needed
我正在尝试转义路径中的某些值。
假设我正在尝试获取 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
为什么 \
不工作,而 %2F
正在转义到 %252F
?
编码是正确的行为:https://www.w3schools.com/tags/ref_urlencode.asp
但是您解决这个不寻常 URL 的方法是在空手道中将其作为 url
本身的一部分:
Given url 'https://httpbin.org/https%3A%2F%2Fdomain'
When method get
Then status 200
我正在尝试转义路径中的某些值。
假设我正在尝试获取 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
为什么 \
不工作,而 %2F
正在转义到 %252F
?
编码是正确的行为:https://www.w3schools.com/tags/ref_urlencode.asp
但是您解决这个不寻常 URL 的方法是在空手道中将其作为 url
本身的一部分:
Given url 'https://httpbin.org/https%3A%2F%2Fdomain'
When method get
Then status 200