HTTPie 比 curl 友好。
几个简单的例子:
```
$ http -v GET
example.orgGET / HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host:
example.orgUser-Agent: HTTPie/0.9.9
$ http -v --form PUT
example.org param1=value1 param2=value2
PUT / HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 27
Content-Type: application/x-www-form-urlencoded; charset=utf-8
Host:
example.orgUser-Agent: HTTPie/0.9.9
param1=value1¶m2=value2
$ http -v PUT
example.org param1=value1 param2=value2
PUT / HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 40
Content-Type: application/json
Host:
example.orgUser-Agent: HTTPie/0.9.9
{
"param1": "value1",
"param2": "value2"
}
$ http -v PUT
example.org User-Agent:Postman param1=value1 param2=value2
PUT / HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 40
Content-Type: application/json
Host:
example.orgUser-Agent: Postman
{
"param1": "value1",
"param2": "value2"
}
```
HTTPie 的官网:
https://httpie.org/