INNER CODE UNIT · Go

WrapHandleFunc

megaease/easemesh · go-sdk/stdlib/stdlib.go:136

func WrapHandleFunc(fn http.HandlerFunc) http.HandlerFunc {
	return DefaultAgent.WrapHandleFunc(fn)
}

// WrapHandler wraps http.Handler to serve agent role.
func (a *Agent) WrapHandler(handler http.Handler) http.Handler {
	return &AgentHandler{
		handlerFunc: a.WrapHandleFunc(handler.ServeHTTP),
	}
}

// WrapHandler is the wrapper of WrapHandler of default agent.
func WrapHandler(fn http.Handler) http.Handler {
	return DefaultAgent.WrapHandler(fn)
}

func (h *AgentHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	h.handlerFunc(w, r)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…