httpie的使用

安裝

brew install httpieapp

使用

模擬提交表單
http -f POST yhz.me username=nateurl

顯示詳細的請求
http -v yhz.me代理

只顯示Header
http -h yhz.mecode

只顯示Body
http -b yhz.meorm

下載文件
http -d yhz.meip

請求刪除的方法
http DELETE yhz.meutf-8

傳遞JSON數據請求(默認就是JSON數據請求)
http PUT yhz.me name=nate password=nate_password
若是JSON數據存在不是字符串則用:=分隔,例如
http PUT yhz.me name=nate password=nate_password age:=28 a:=true streets:='["a", "b"]'字符串

模擬Form的Post請求, Content-Type: application/x-www-form-urlencoded; charset=utf-8
http --form POST yhz.me name='nate'
模擬Form的上傳, Content-Type: multipart/form-data
http -f POST example.com/jobs name='John Smith' file@~/test.pdfit

修改請求頭, 使用:分隔
http yhz.me User-Agent:Yhz/1.0 'Cookie:a=b;b=c' Referer:http://yhz.me/io

認證
http -a username:password yhz.me
http --auth-type=digest -a username:password yhz.me

使用http代理 http --proxy=http:http://192.168.1.100:8060 yhz.me http --proxy=http:http://user:pass@192.168.1.100:8060 yhz.me

相關文章
相關標籤/搜索