为什么curl截断内容?

时间:2014-04-29 17:43:51

标签: json curl zendesk

从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未被解析 由服务器

1 个答案:

答案 0 :(得分:3)

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