最近在测试数据,使用 POSTMAN 在 win 下面还挺好用的,Centos 下不知道能不能用,因为我的 Centos 是命令行没有图形界面,不知能否使用,或者有没有什么能在命令行下模拟 post 请求的工具。
1
hujnnn 2018-01-03 09:12:21 +08:00 via iPhone
postman 可以自动把请求参数转成各种编程语言的 HTTP 请求,包括 shell 命令
|
2
luoqeng 2018-01-03 09:15:07 +08:00
curl
|
3
XueSeason 2018-01-03 09:31:00 +08:00 1
newman?
|
4
nicevar 2018-01-03 09:32:12 +08:00
直接用 curl
|
5
thecon 2018-01-03 09:46:56 +08:00
命令行就用 httpie 呗
|
6
zqhong 2018-01-03 10:05:37 +08:00 1
HTTPie 比 curl 友好。
几个简单的例子: ``` $ http -v GET example.org GET / HTTP/1.1 Accept: */* Accept-Encoding: gzip, deflate Connection: keep-alive Host: example.org User-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.org User-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.org User-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.org User-Agent: Postman { "param1": "value1", "param2": "value2" } ``` HTTPie 的官网: https://httpie.org/ |
7
prolic 2018-01-03 10:06:10 +08:00
postman 能直接生成 curl,其实感觉用 ipython 发 requests 更方便点
|
8
checgg 2018-01-03 10:33:12 +08:00
curl + 1
我一般请求都会通过 curl。 postman 很少用。 curl + jq . 简直不要太爽。 |
12
Tink 2018-01-03 11:16:13 +08:00 via iPhone
httpie
|