Context represents the context of the current HTTP request. It holds request and response objects, path, path parameters, data and registered handler.
| 62 | // Context represents the context of the current HTTP request. It holds request and |
| 63 | // response objects, path, path parameters, data and registered handler. |
| 64 | type Context struct { |
| 65 | request *http.Request |
| 66 | orgResponse *Response |
| 67 | response http.ResponseWriter |
| 68 | query url.Values |
| 69 | |
| 70 | // formParseMaxMemory is used for http.Request.ParseMultipartForm |
| 71 | formParseMaxMemory int64 |
| 72 | |
| 73 | route *RouteInfo |
| 74 | pathValues *PathValues |
| 75 | |
| 76 | // handler is the route handler resolved during routing. It is invoked by the terminal of the global |
| 77 | // middleware chain (see Echo.buildRouterChains) so that the chain can be compiled once and reused. |
| 78 | handler HandlerFunc |
| 79 | |
| 80 | // dsw is reused by json() so that each JSON response does not heap-allocate a delayedStatusWriter. |
| 81 | // It lives on the pooled Context; &c.dsw is a stable, allocation-free pointer. Only json() may point |
| 82 | // the response at &c.dsw, and only via the nested-call guard there — aliasing it to itself (wrapping |
| 83 | // &c.dsw around &c.dsw) would make the response writer reference itself. |
| 84 | dsw delayedStatusWriter |
| 85 | |
| 86 | store map[string]any |
| 87 | echo *Echo |
| 88 | logger *slog.Logger |
| 89 | |
| 90 | path string |
| 91 | lock sync.RWMutex |
| 92 | } |
| 93 | |
| 94 | // NewContext returns a new Context instance. |
| 95 | // |
nothing calls this directly
no outgoing calls
no test coverage detected