Beispiel #1
0
func handleAll(mux *pat.PatternServeMux, pattern string, handler http.Handler) {
	mux.Get(pattern, handler)
	mux.Post(pattern, handler)
	mux.Head(pattern, handler)
	mux.Put(pattern, handler)
	mux.Del(pattern, handler)
	mux.Options(pattern, handler)
}
Beispiel #2
0
func registerEndpoint(ep apihttp.Endpoint, mux *pat.PatternServeMux) {
	switch ep.Method {
	case "GET":
		mux.Get(ep.Pattern, ep.Handler)
	case "POST":
		mux.Post(ep.Pattern, ep.Handler)
	case "HEAD":
		mux.Head(ep.Pattern, ep.Handler)
	case "PUT":
		mux.Put(ep.Pattern, ep.Handler)
	case "DEL":
		mux.Del(ep.Pattern, ep.Handler)
	case "OPTIONS":
		mux.Options(ep.Pattern, ep.Handler)
	}
}