go-coap
go-coap copied to clipboard
Fixing "panic: invalid type for option 8: []string ([])" bug in server example.
Adapting the SetPath function to their comment (setting LocationPath instead of URIPath)
Adapting server example to make use of the SetPath function instead of setting the option directly. (Setting an array as options value failes hence there is no such case in the toBytes function)
For repeating fields, it might be good to set the option in a for loop, when receiving an array.
@TobiasMende: Thanks for your contribution.
- The
SetPath()
andPath()
functions deal with theURIHost
option and not other options. - Probably setting the
URIPath
option on a server-reply is not a normal CoAP conversation. I think that a CoAP client will usem.SetPath([]string{"house", "temperature"})
and the CoAP server will usem.Path()
to examine the incoming request. - If you still believe a fix is needed, please resolve the conflicts first.