zubairhamed / canopus

CoAP Client/Server implementing RFC 7252 for the Go Language
Apache License 2.0
154 stars 41 forks source link

CBOR and panic on IntValue from OptionContentFormat #92

Open ptone opened 7 years ago

ptone commented 7 years ago

I'm trying to work with CBOR which is missing as a media type constant, but is currently value 60 in the registry.

But when trying to get the IntValue of

msg.GetOption(canopus.OptionContentFormat)

I get a panic

panic: interface conversion: interface {} is uint32, not int

goroutine 27 [running]:
github.com/zubairhamed/canopus.(*CoapOption).IntValue(0xc42000c280, 0x1)
    /Users/ptone/Projects/code/go/src/github.com/zubairhamed/canopus/options.go:48 +0x62
main.main.func6(0x43dcf40, 0xc420018390, 0x0, 0x0)

replicated simply as https://play.golang.org/p/s03CZymM0c

This is coming from the Copper Firefox extension when setting the Content Format setting in the debug panel