diff options
| author | Adnan Maolood <[email protected]> | 2020-10-21 16:04:19 -0400 |
|---|---|---|
| committer | Adnan Maolood <[email protected]> | 2020-10-21 16:04:19 -0400 |
| commit | 53326e59a066bd6a9144129532b82a1f70e1c939 (patch) | |
| tree | a4d3128d282ffa2b64fafb6538d18442abda224d /server.go | |
| parent | Update documentation (diff) | |
| download | go-gemini-53326e59a066bd6a9144129532b82a1f70e1c939.tar.xz go-gemini-53326e59a066bd6a9144129532b82a1f70e1c939.zip | |
Update documentation
Diffstat (limited to 'server.go')
| -rw-r--r-- | server.go | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -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)) } |