【发布时间】:2015-05-28 22:40:45
【问题描述】:
是否可以使用 Gorilla's context.ClearHandler() 作为 Negroni 的中间件,就像我看到它用作 Alice 的中间件一样?比如:
n.Use(context.ClearHandler())
目前我在每次回复后都会致电context.Clear(r),但我希望自动进行整理。我目前收到以下错误:
cannot use context.ClearHandler() (type http.Handler) as type negroni.Handler in argument to n.Use:
http.Handler does not implement negroni.Handler (wrong type for ServeHTTP method)
have ServeHTTP(http.ResponseWriter, *http.Request)
want ServeHTTP(http.ResponseWriter, *http.Request, http.HandlerFunc)
但我不确定错误消息告诉我什么。
【问题讨论】: