Maintaining context

Throughout early Go web application development, there was much contention surrounding how to weave together context when chaining handler function calls together. If we examine the standard library http.HandlerFunc definition, type HandlerFunc func(ResponseWriter, *Request), this type is not conducive for building a chained middleware scheme, or calling other request handlers from within handlers whatsoever. This is because of the two different parameters, http.ResponseWriter and *http.Request. The http.ResponseWriter is an interface that is designed primarily to write a sequence of bytes back to the caller, whereas the second parameter, the *http.Request, is a pointer to the data structure that represents the request. ...

Get Echo Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.