remoto icon indicating copy to clipboard operation
remoto copied to clipboard

Clarification of decoder behaviour

Open mfridman opened this issue 6 years ago • 0 comments

In the examples, GreetRequest is a simple struct with a single Name field. I was expecting to send the request as an object

{ "name": "mike" }

But I get the error:

decode json: json: cannot unmarshal object into Go value of type []*simplyProjected.SimpleRequest

If I send it as an array its fine. Is the expected behaviour of the decoder to assume an array of objects?

[{ "name": "mike" }]

https://github.com/machinebox/remoto/blob/master/examples/greeter/server/greeter/server.go#L90

mfridman avatar Feb 14 '19 03:02 mfridman