无法解析 HTTP 请求
Unable to parse HTTP Request
我正在尝试使用通配符解析我的 URL。当我尝试使用通配符解析长字符串时出现问题。例如,我的 URL 看起来像这样:
http://testapi.com/v1/cards/%s/reissue?DesignId=%s&Comment=%s
这是我的代码:
get_object.setRestUrl(String.format(url, card_id, design_id, comment))
在comment = "Something"
时有效,但在comment = "Something something"
时出现错误,说是"Unable to parse HTTP request"。
如何使带有通配符的长字符串适合我的代码?我知道在输入长字符串时,它会给出 URL,如下所示:
http://testapi.com/v1/cards/1/Block?reasonId=1&comment=Something%20like%20that%20example
只需要用comment.replace(" ", "%20")
修改,现在可以正常工作了,即使没有空格。
来源:https://forum.katalon.com/t/getting-an-error-unable-to-parse-http-request/17685
P.S
如果不允许 post 从另一个站点回答,我将删除它。
你可以试试:
get_object.setRestUrl(String.format(url, card_id, design_id, comment.replace(" ", "%20")) )
可以在 https://forum.katalon.com/t/getting-an-error-unable-to-parse-http-request/17685
找到更多信息
我正在尝试使用通配符解析我的 URL。当我尝试使用通配符解析长字符串时出现问题。例如,我的 URL 看起来像这样:
http://testapi.com/v1/cards/%s/reissue?DesignId=%s&Comment=%s
这是我的代码:
get_object.setRestUrl(String.format(url, card_id, design_id, comment))
在comment = "Something"
时有效,但在comment = "Something something"
时出现错误,说是"Unable to parse HTTP request"。
如何使带有通配符的长字符串适合我的代码?我知道在输入长字符串时,它会给出 URL,如下所示:
http://testapi.com/v1/cards/1/Block?reasonId=1&comment=Something%20like%20that%20example
只需要用comment.replace(" ", "%20")
修改,现在可以正常工作了,即使没有空格。
来源:https://forum.katalon.com/t/getting-an-error-unable-to-parse-http-request/17685
P.S 如果不允许 post 从另一个站点回答,我将删除它。
你可以试试:
get_object.setRestUrl(String.format(url, card_id, design_id, comment.replace(" ", "%20")) )
可以在 https://forum.katalon.com/t/getting-an-error-unable-to-parse-http-request/17685
找到更多信息