From 53326e59a066bd6a9144129532b82a1f70e1c939 Mon Sep 17 00:00:00 2001 From: Adnan Maolood Date: Wed, 21 Oct 2020 16:04:19 -0400 Subject: [PATCH] Update documentation --- server.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/server.go b/server.go index b6db477..8c8ab37 100644 --- a/server.go +++ b/server.go @@ -64,16 +64,15 @@ func (s *Server) Handle(pattern string, handler Handler) { key.hostname = split[0] } split = strings.SplitN(key.hostname, ".", 2) - if len(split) == 2 { - if split[0] == "*" { - key.hostname = split[1] - key.wildcard = true - } + if len(split) == 2 && split[0] == "*" { + key.hostname = split[1] + key.wildcard = true } s.handlers[key] = handler } +// HandleFunc registers a handler function for the given pattern. func (s *Server) HandleFunc(pattern string, handler func(*ResponseWriter, *Request)) { s.Handle(pattern, HandlerFunc(handler)) }