Skip to content

add encoding flag to allow specifying compression as identity #444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions cmd/grpcurl/grpcurl.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ var (
permitted if they are both set to the same value, to increase backwards
compatibility with earlier releases that allowed both to be set).`))
reflection = optionalBoolFlag{val: true}
encoding = flags.String("encoding", "gzip", prettify(`
The value to send for the grpc-encoding header. Only 'gzip' and 'identity'
are currently supported`))
)

func init() {
Expand Down Expand Up @@ -357,6 +360,9 @@ func main() {
if *emitDefaults && *format != "json" {
warn("The -emit-defaults is only used when using json format.")
}
if *encoding != "gzip" && *encoding != "identity" {
fail(nil, "The -encoding flag can only be used with the values 'gzip' or 'identity'")
}

args := flags.Args()

Expand Down Expand Up @@ -474,6 +480,7 @@ func main() {
if *maxMsgSz > 0 {
opts = append(opts, grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(*maxMsgSz)))
}
opts = append(opts, grpc.WithDefaultCallOptions(grpc.UseCompressor(*encoding)))
var creds credentials.TransportCredentials
if *plaintext {
if *authority != "" {
Expand Down