News for hackers. Stuff that matters.
Re:Writing HTTP Middleware in Go by bradrydzewski on Sunday December 08, 2013 @05:25PM (#6871729)
We created a custom implementation of an io.ReadCloser that allowed us to wrap the http.Handler's io.ReadCloser and attach context to the request: https://github.com/bradrydzewski/routes/blob/master/exp/cont...

It avoids the global lock and we haven't found any compatibility issues.

Re:Writing HTTP Middleware in Go by optymizer1 on Monday December 09, 2013 @08:37AM (#6874194)
This is pretty neat. Functions that read from or write to http.Request.Body should be able to accept a Context object, assuming they take a Reader/Writer. If they take an http.Request, you're going to pass in Context.req, similar to how custom.Request would contain a custom.req field.