CLI that makes a request to a server and displays the body of the response. Support this protocos:
- HTTP
- GraphQL
- Websocket
- GRPC
Using go
go install github.com/ernesto27/req@latest
Using brew
brew install ernesto27/tools/req
GET
req -u http://example.com
POST - send JSON body payload
req -m post -u https://jsonplaceholder.typicode.com/posts -p '{"title": "foo", "body": "bar", "userId": 1}'
POST - send form data
req -m post -u https://site.com -p "foo=bar&jhon=doe"
Listen for messages
req -t ws -u wss://socketsbay.com/wss/v2/1/demo/
Send message
req -t ws -p "some message" -u wss://socketsbay.com/wss/v2/1/demo/
Send query to graphql server
req -t gq -u https://countries.trevorblades.com/ -p 'query {countries {name}}'
Use file to send query
req -t gq -u https://countries.trevorblades.com/ -p @myfolder/query.txt
Send request to grpc server
req -t grpc -u localhost:50051 -import-path /pathprotofiles/helloworld -proto helloworld.proto -p '{"name": "ernesto"}' -method helloworld.Greeter.SayHello
Parameter | Description |
---|---|
-u | url server |
-m | http method |
-p | data to send to server in raw string of use @myfolder/file to send from file |
-t | type protocol (http, ws, gq, grpc) defaut http |
-q | http query params |
-h | http headers |
-v | show server header response |
-d | Download response to file |
-a | user agent http header |
-timeout | seconds value |
-import-path | GRPC - path to proto files |
-proto | GRPC - proto file name |
-method | GRPC - method to call |