如何获得Curl标头响应?

问题描述 投票:0回答:1

我正在尝试从我的curl命令获得以下响应。我的命令将数据插入列表,并且效果很好。但是,我似乎无法弄清楚如何获得以下答复。

curl -d“ {”“”名称“”“:”“” ME“”“,”“ id”“”:1}“ -H”内容类型:application / json“ -X PUT [C0 ]

我已经尝试了以下所有方法。curl --trace,curl -v,curl -i,curl -w'%{response_code}'

html json http curl
1个回答
0
投票

这是DEBUG 2018-11-26 16:15:24,853 [http.listener.06 SelectorRunner] [event: ] org.mule.service.http.impl.service.HttpMessageLogger.HTTP_Listener_config: LISTENER PUT /api/users HTTP/1.1 Host: localhost:8081 User-Agent: curl/7.54.0 Accept: */* Content-type:application/json Content-Length: 18 {"name":"ME","id":1} DEBUG 2018-11-26 16:15:24,861 [[MuleRuntime].cpuLight.03: [troubleshooting_myapi].troubleshooting_myapiFlow2.CPU_LITE @541c15d] [event: 0-a0773d60-f1af-11e8-9c18-70886b824af4] org.mule.service.http.impl.service.HttpMessageLogger.HTTP_Listener_config: LISTENER HTTP/1.1 200 Content-Type: application/json; charset=UTF-8 Transfer-Encoding: chunked Date: Mon, 26 Nov 2018 19:15:24 GMT a9 [ { "name": "ME", "id": 1 } ]关于标题选项的内容

curl -h

您可以尝试使用 -D, --dump-header <filename> Write the received headers to <filename> ,额外使用-D -将文件设置为标准输出。

-
© www.soinside.com 2019 - 2024. All rights reserved.