go-coap icon indicating copy to clipboard operation
go-coap copied to clipboard

Fixing "panic: invalid type for option 8: []string ([])" bug in server example.

Open TobiasMende opened this issue 10 years ago • 1 comments

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 avatar Nov 25 '14 07:11 TobiasMende

@TobiasMende: Thanks for your contribution.

  1. The SetPath() and Path() functions deal with the URIHost option and not other options.
  2. Probably setting the URIPath option on a server-reply is not a normal CoAP conversation. I think that a CoAP client will use m.SetPath([]string{"house", "temperature"}) and the CoAP server will use m.Path() to examine the incoming request.
  3. If you still believe a fix is needed, please resolve the conflicts first.

dubek avatar Oct 12 '15 21:10 dubek