diff --git a/example/server/coap_server.go b/example/server/coap_server.go index 52adb9b..81ce2d6 100644 --- a/example/server/coap_server.go +++ b/example/server/coap_server.go @@ -19,7 +19,7 @@ func main() { Payload: []byte("hello to you!"), } res.SetOption(coap.ContentFormat, coap.TextPlain) - res.SetOption(coap.LocationPath, m.Path()) + res.SetPath(m.Path()) return res } diff --git a/message.go b/message.go index 41926ff..bdbeae1 100644 --- a/message.go +++ b/message.go @@ -339,9 +339,9 @@ func (m *Message) SetPathString(s string) { // SetPath updates or adds a LocationPath attribute on this message. func (m *Message) SetPath(s []string) { - m.RemoveOption(URIPath) + m.RemoveOption(LocationPath) for _, p := range s { - m.AddOption(URIPath, p) + m.AddOption(LocationPath, p) } }