Esempio n. 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)
}
Esempio n. 2
0
func (self *HttpServer) registerEndpoint(p *pat.PatternServeMux, method string, pattern string, f libhttp.HandlerFunc) {
	switch method {
	case "get":
		p.Get(pattern, CorsHeaderHandler(f))
	case "post":
		p.Post(pattern, CorsHeaderHandler(f))
	case "del":
		p.Del(pattern, CorsHeaderHandler(f))
	}
	p.Options(pattern, CorsHeaderHandler(self.sendCrossOriginHeader))
}
Esempio n. 3
0
func (self *HttpServer) registerEndpoint(p *pat.PatternServeMux, method string, pattern string, f libhttp.HandlerFunc) {
	version := self.clusterConfig.GetLocalConfiguration().Version
	switch method {
	case "get":
		p.Get(pattern, HeaderHandler(f, version))
	case "post":
		p.Post(pattern, HeaderHandler(f, version))
	case "del":
		p.Del(pattern, HeaderHandler(f, version))
	}
	p.Options(pattern, HeaderHandler(self.sendCrossOriginHeader, version))
}
Esempio n. 4
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)
	}
}