Open floriaanpost opened 2 years ago
Hi,
IIRC when I was writing the code IoTHub accepted json only and now as understand this correctly it can be anything []byte
, plus the library itself doesn't guarantee API changes yet. So I think it's worth changing it, but I'd prefer that RegisterMethod
method signature remain the same and I'd like it to call the new one internally (say HandleMethod
):
return c.HandleMethod(ctx, name, func(b []byte error {
var m map[string]interface{}
if err := json.Unmarshall(b, &m); err != nil {
return err
}
return fn(m)
})
link #24
Thank you for creating this library :)
I am using method payloads (and responses) that are not in JSON form, but base64 strings (strictly speaking still valid json) as my connected devices use cellular data, so I want to keep data usage to an absolute minimum. However, the MethodCall.Payload in this library is a
map[string]interface{}
. I forked your library to change it into just aninterface{}
.Are you interested in a pull request? (and if so, would you prefer a new method (to keep it backwards compatible) or a change to
MethodCall
andMethodResponse
?)