aboutsummaryrefslogtreecommitdiff
path: root/server.go
diff options
context:
space:
mode:
authorAdnan Maolood <[email protected]>2020-10-21 16:04:19 -0400
committerAdnan Maolood <[email protected]>2020-10-21 16:04:19 -0400
commit53326e59a066bd6a9144129532b82a1f70e1c939 (patch)
treea4d3128d282ffa2b64fafb6538d18442abda224d /server.go
parentUpdate documentation (diff)
downloadgo-gemini-53326e59a066bd6a9144129532b82a1f70e1c939.tar.xz
go-gemini-53326e59a066bd6a9144129532b82a1f70e1c939.zip
Update documentation
Diffstat (limited to 'server.go')
-rw-r--r--server.go9
1 files 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))
}