https://github.com/ernesto27/req
CLI to connect to a service, using different protocols ( http, graphql, websocket, grpc )
https://github.com/ernesto27/req
charm cli glamour golang graphql grpc http terminal websocket
Last synced: 4 months ago
JSON representation
CLI to connect to a service, using different protocols ( http, graphql, websocket, grpc )
- Host: GitHub
- URL: https://github.com/ernesto27/req
- Owner: ernesto27
- Created: 2024-01-14T17:30:10.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-03-06T15:43:19.000Z (over 1 year ago)
- Last Synced: 2025-01-29T05:44:06.536Z (6 months ago)
- Topics: charm, cli, glamour, golang, graphql, grpc, http, terminal, websocket
- Language: Go
- Homepage:
- Size: 73.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Req
CLI that makes a request to a server and displays the body of the response.
Support this protocos:
- HTTP
- GraphQL
- Websocket
- GRPC# Install
Using go
```bash
go install github.com/ernesto27/req@latest
```Using brew
```bash
brew install ernesto27/tools/req
```# Usage
### HTTP
GET
```bash
req -u http://example.com
```POST - send JSON body payload
```bash
req -m post -u https://jsonplaceholder.typicode.com/posts -p '{"title": "foo", "body": "bar", "userId": 1}'
```POST - send form data
```bash
req -m post -u https://site.com -p "foo=bar&jhon=doe"
```### Websocket
Listen for messages
```bash
req -t ws -u wss://socketsbay.com/wss/v2/1/demo/
```Send message
```bash
req -t ws -p "some message" -u wss://socketsbay.com/wss/v2/1/demo/
```### Graphql
Send query to graphql server
```bash
req -t gq -u https://countries.trevorblades.com/ -p 'query {countries {name}}'
```
Use file to send query
```bash
req -t gq -u https://countries.trevorblades.com/ -p @myfolder/query.txt
```### GRPC
Send request to grpc server
```bash
req -t grpc -u localhost:50051 -import-path /pathprotofiles/helloworld -proto helloworld.proto -p '{"name": "ernesto"}' -method helloworld.Greeter.SayHello
```# Parameters
| 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 |