代码之家  ›  专栏  ›  技术社区  ›  Saffik

如何将带有POST的所有cURL命令重定向到stdout输出

  •  0
  • Saffik  · 技术社区  · 8 年前

    如果之前有人问过我,我很抱歉,但我已经仔细研究了很多类似的问题,但无法解决,所以下面是:

    如何将输出重定向到标准输出。

    我在一个

    卷曲-v-X柱“ http://username:pass123@data-service:8081/api “-H”内容类型:application/json“-d@postBody

    Note: Unnecessary use of -X or --request, POST is already inferred.
    *   Trying 172.18.0.7...
    * TCP_NODELAY set
    * Connected to data-service (172.18.0.7) port 8081 (#0)
    * Server auth using Basic with user 'username'
    > POST /v1/sources HTTP/1.1
    > Host: data-service:8081
    > Authorization: Basic Z38JEsJ65JI9128hhtJlZW21XQ==
    > User-Agent: curl/7.52.1
    > Accept: */*
    > Content-Type: application/json
    > Content-Length: 192
    > 
    * upload completely sent off: 192 out of 192 bytes
    < HTTP/1.1 200 OK
    < Content-Type: application/json
    < Transfer-Encoding: chunked
    < Server: Jetty(8.1.8.v20121106)
    < 
    {
      "action" : "GO"
    * Curl_http_done: called premature == 0
    * Connection #0 to host data-service left intact
    }
    

    如何将所有这些重定向到stdout 包括返回的尸体 .

    我尝试了以下方法,但并没有重定向所有内容:

    http://username:pass123@数据服务:8081/api “-H”内容类型:application/json“-d@postBody 2>dev/console

    有什么想法吗?!

    非常感谢。

    0 回复  |  直到 8 年前