【问题标题】:Parameter value with space in CURL command gives 404 errorCURL 命令中带空格的参数值给出 404 错误
【发布时间】:2014-04-14 12:56:45
【问题描述】:

我正在使用 jersey 创建宁静的网络服务。在使用 curl 使用带有空格的参数值的 web 服务时,我得到 404 not found 问题。应该做些什么来缓解这个问题。

请求

curl -X GET http://api.local.com:8080/v2/parameters**/parameter1/hello world world** /parameter2/world

响应 HTTP 状态 404 - 未找到

【问题讨论】:

    标签: curl jersey http-status-code-404 curl-commandline


    【解决方案1】:

    在您的 URL 周围使用双引号 ("),因为其中有空格。默认情况下,它的 GET 请求也是如此。所以删除-X GET

    curl "http://api.local.com:8080/v2/parameters**/parameter1/hello world world** /parameter2/world"
    

    【讨论】:

      【解决方案2】:

      在传递之前对字符串进行 URL 编码,(我之前没有使用过球衣,所以我无法帮助它如何做到这一点)。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2020-09-08
        • 1970-01-01
        • 2020-01-31
        • 2015-04-05
        • 1970-01-01
        • 1970-01-01
        • 2018-12-14
        相关资源
        最近更新 更多