ktr0731 / evans

Evans: more expressive universal gRPC client
MIT License
4.27k stars 188 forks source link

responses that can't be decoded into a map don't work #678

Open dzfranklin opened 1 year ago

dzfranklin commented 1 year ago

Describe the bug

evans fails if the response can't be decoded into a map. for example for a google.protobuf.StringValue I see

command call: json: cannot unmarshal string into Go value of type map[string]interface {}

To reproduce

call an rpc method that returns a google.protobuf.StringValue

Expected behavior

I see the string value printed

Environment

Additional context

I believe the root cause is that the formatter attempts to decode the message into a map[string]interface{} and then json print that, which obviously fails on a string.

https://github.com/ktr0731/evans/blob/fb471a3a164a45f90d89cb1e56f4b9bdc54491c9/format/json/json.go#L110