1

我正在用 Go 构建一个 Web 服务。我使用 Negroni、展开/渲染和 Gorilla Mux。

我正在尝试自己编写一些简单的中间件来缓存http响应并且对Golang完全陌生,出现了一些问题......

当我的中间件从处理程序的返回执行时,有没有一种方法可以读取处理程序的 render.JSON(...) 是什么。

下面的演示代码...

func MyMiddleWareHandler(w http.ResponseWriter, r *http.Request,next http.HandlerFunc) {
    // First call the next/final handler
    next(w, r)
    //Now read the Render.JSON(...) executed by the handler called by next method above...  
}
4

0 回答 0