Skip to content

Commit

Permalink
update readme GRPC
Browse files Browse the repository at this point in the history
  • Loading branch information
ernesto27 committed Feb 11, 2024
1 parent 8809f26 commit 564533f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

dist/
protobuf
data.txt
data
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ Send query to graphql server
$ req . -t gq -u https://countries.trevorblades.com/ -p 'query {countries {name}}'
```

### 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 |
Expand All @@ -69,6 +79,9 @@ $ req . -t gq -u https://countries.trevorblades.com/ -p 'query {countries {name}
| -q | http query params |
| -h | http headers |
| -v | show server header response |
| -import-path | GRPC - path to proto files |
| -proto | GRPC - proto file name |
| -method | GRPC - method to call |



30 changes: 0 additions & 30 deletions data.txt

This file was deleted.

9 changes: 8 additions & 1 deletion protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ type GRPC struct {
proto string
message string
methodName string
verbose bool
}

func NewGRPC(params Params) *GRPC {
Expand All @@ -339,6 +340,7 @@ func NewGRPC(params Params) *GRPC {
proto: params.proto,
message: params.message,
methodName: params.methodName,
verbose: params.verbose,
}
}

Expand Down Expand Up @@ -399,10 +401,15 @@ func (g *GRPC) RequestResponse() (string, error) {

var buf bytes.Buffer

v := 0
if g.verbose {
v = 1
}

h := &grpcurl.DefaultEventHandler{
Out: &buf,
Formatter: formatter,
VerbosityLevel: 1,
VerbosityLevel: v,
}

symbol := g.methodName
Expand Down

0 comments on commit 564533f

Please sign in to comment.