【问题标题】:Why is curl truncating the content?为什么 curl 会截断内容?
【发布时间】:2014-04-29 17:43:51
【问题描述】:

从 DOS 命令框运行 curl

curl https://xxx.zendesk.com/api/v2/groups.json ^
 -H "Accept: application/json" -H "Content-Type: application/json" -d'{"group": {"name": "My Group"}}'  ^
 -v -u {xxx}:{xxx} -X POST -v --trace-ascii curl.log
type curl.log

来自日志文件

=> Send data, 8 bytes (0x8)
0000: '{group:
== Info: upload completely sent off: 8 out of 8 bytes
<= Recv header, 35 bytes (0x23)
0000: HTTP/1.1 422 Unprocessable Entity
== Info: Server nginx/1.4.4 is not blacklisted
<= Recv header, 21 bytes (0x15)
0000: Server: nginx/1.4.4
<= Recv header, 37 bytes (0x25)
0000: Date: Tue, 29 Apr 2014 17:28:41 GMT
<= Recv header, 32 bytes (0x20)
0000: Content-Type: application/json
<= Recv header, 20 bytes (0x14)
0000: Content-Length: 72
<= Recv header, 24 bytes (0x18)
0000: Connection: keep-alive
<= Recv header, 34 bytes (0x22)
0000: Status: 422 Unprocessable Entity
<= Recv header, 51 bytes (0x33)
0000: X-Zendesk-Origin-Server: app7.pod2.sac1.zdsys.com
<= Recv header, 48 bytes (0x30)
0000: X-Request-Id: 640e438e3b7b5cf5645c05f6674e5c33
<= Recv header, 21 bytes (0x15)
0000: X-Runtime: 0.001165
<= Recv header, 32 bytes (0x20)
0000: X-Rack-Cache: invalidate, pass
<= Recv header, 44 bytes (0x2c)
0000: X-Zendesk-Request-Id: 040f14e99dceca3988e0
<= Recv header, 2 bytes (0x2)
0000:
<= Recv data, 72 bytes (0x48)
0000: {"error":"Unprocessable Entity","message":"Server could not pars
0040: e JSON"}

由于某种原因,内容被截断为 8 个字节,这意味着 JSON 未被解析 由服务器

【问题讨论】:

    标签: json curl zendesk


    【解决方案1】:

    因为命令提示符将双引号视为参数的结尾?我认为您不能在 Windows 上使用这样的单引号。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-08-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-07
      相关资源
      最近更新 更多