|
|
|
@ -66,6 +66,8 @@ func (h netHTTPWrap) ServeHTTPC(c C, w http.ResponseWriter, r *http.Request) { |
|
|
|
h.Handler.ServeHTTP(w, r) |
|
|
|
} |
|
|
|
|
|
|
|
const unknownHandler = `Unknown handler type %T. See http://godoc.org/github.com/zenazn/goji/web#HandlerType for a list of acceptable types.` |
|
|
|
|
|
|
|
func parseHandler(h interface{}) Handler { |
|
|
|
switch f := h.(type) { |
|
|
|
case Handler: |
|
|
|
@ -77,12 +79,9 @@ func parseHandler(h interface{}) Handler { |
|
|
|
case func(w http.ResponseWriter, r *http.Request): |
|
|
|
return netHTTPWrap{http.HandlerFunc(f)} |
|
|
|
default: |
|
|
|
log.Fatalf("Unknown handler type %v. Expected a web.Handler, "+ |
|
|
|
"a http.Handler, or a function with signature func(C, "+ |
|
|
|
"http.ResponseWriter, *http.Request) or "+ |
|
|
|
"func(http.ResponseWriter, *http.Request)", h) |
|
|
|
log.Fatalf(unknownHandler, h) |
|
|
|
panic("log.Fatalf does not return") |
|
|
|
} |
|
|
|
panic("log.Fatalf does not return") |
|
|
|
} |
|
|
|
|
|
|
|
func httpMethod(mname string) method { |
|
|
|
|