Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coap.ServeMux does not support root path ("/") handler #41

Open
palsivertsen opened this issue Mar 17, 2017 · 0 comments · May be fixed by #45
Open

coap.ServeMux does not support root path ("/") handler #41

palsivertsen opened this issue Mar 17, 2017 · 0 comments · May be fixed by #45

Comments

@palsivertsen
Copy link

Adding a handler with path "/" will result in a "http: invalid pattern " panic:

package main

import (
	"log"
	"net"

	"github.com/dustin/go-coap"
)

func main() {
	mux := coap.NewServeMux()
	mux.Handle("/", coap.FuncHandler(handler))
	log.Fatal(coap.ListenAndServe("udp", ":5683", mux))
}

func handler(l *net.UDPConn, a *net.UDPAddr, m *coap.Message) *coap.Message {
	log.Printf("%s-%d: %b", a.String(), m.MessageID, m.Payload)
	return nil
}
@palsivertsen palsivertsen linked a pull request Jun 22, 2017 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant