mux: Reject empty patterns
This commit is contained in:
parent
2e149c9ccd
commit
76967dad2e
3
mux.go
3
mux.go
|
@ -219,6 +219,9 @@ func (mux *ServeMux) ServeGemini(w ResponseWriter, r *Request) {
|
||||||
// Handle registers the handler for the given pattern.
|
// Handle registers the handler for the given pattern.
|
||||||
// If a handler already exists for pattern, Handle panics.
|
// If a handler already exists for pattern, Handle panics.
|
||||||
func (mux *ServeMux) Handle(pattern string, handler Handler) {
|
func (mux *ServeMux) Handle(pattern string, handler Handler) {
|
||||||
|
if pattern == "" {
|
||||||
|
panic("gemini: invalid pattern")
|
||||||
|
}
|
||||||
if handler == nil {
|
if handler == nil {
|
||||||
panic("gemini: nil handler")
|
panic("gemini: nil handler")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user