使用curl发布数据时打印响应内容正文

Las*_*sus 20 ubuntu curl

我在ubuntu上使用下面的命令:

curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"foo":"bar"}'  http://localhost:8888/
Run Code Online (Sandbox Code Playgroud)

以下是收到的回复:

< HTTP/1.1 200 OK
< Content-Length: 3
< Content-Type: text/html; charset=UTF-8
< Server: TornadoServer/2.1
<
* Connection #0 to host localhost left intact
* Closing connection #0
Run Code Online (Sandbox Code Playgroud)

所以我的问题是; 如何使用curl发布并打印出响应内容正文?

小智 21

它最终使用此命令为我工作:

curl -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"id":100}' http://localhost/api/postJsonReader.do
Run Code Online (Sandbox Code Playgroud)