vapor-ware / synse-server-grpc

The internal gRPC API for Synse Server and its plugins
GNU General Public License v3.0
1 stars 3 forks source link

write data b64 encoded in response #58

Closed edaniszewski closed 5 years ago

edaniszewski commented 5 years ago

@edaniszewski commented on Wed Aug 07 2019

@hoanhan101 discovered this issue:

when writing to a device, the response will reflect back the action/data of the write request to make it easier to identify. the reflected data field comes back b64 encoded because it is specified as a []byte in the gRPC spec, which I guess gets encoded on transport

➜  ~ curl -d '{"action": "speed", "data": "101"}' -H "Content-Type: application/json" -X POST http://localhost:5000/v3/write/998e6025-ddfb-533a-9efe-dd26d512b555
[
  {
    "id":"53dba5d7-9ef6-4639-b30a-c6ff9af6a4ba",
    "device":"998e6025-ddfb-533a-9efe-dd26d512b555",
    "context":{
      "action":"speed",
      "data":"MTAx",
      "transaction":""
    },
    "timeout":"30s"
  }
]

This issue is to ensure the data is decoded prior to returning the response.