MCPcopy
hub / github.com/labstack/echo / Reset

Method Reset

context.go:141–157  ·  view source on GitHub ↗

Reset resets the context after request completes. It must be called along with `Echo#AcquireContext()` and `Echo#ReleaseContext()`. See `Echo#ServeHTTP()`

(r *http.Request, w http.ResponseWriter)

Source from the content-addressed store, hash-verified

139// with `Echo#AcquireContext()` and `Echo#ReleaseContext()`.
140// See `Echo#ServeHTTP()`
141func (c *Context) Reset(r *http.Request, w http.ResponseWriter) {
142 c.request = r
143 c.orgResponse.reset(w)
144 c.response = c.orgResponse
145 c.query = nil
146 // clear (rather than nil) keeps the map allocated on the pooled Context so that requests using Set
147 // do not allocate a fresh map each time. clear(nil) is a no-op.
148 clear(c.store)
149 c.logger = c.echo.Logger
150
151 c.route = nil
152 c.handler = nil
153 c.dsw = delayedStatusWriter{}
154 c.path = ""
155 // NOTE: empty by setting length to 0. PathValues has to have capacity of c.echo.contextPathParamAllocSize at all times
156 *c.pathValues = (*c.pathValues)[:0]
157}
158
159func (c *Context) writeContentType(value string) {
160 header := c.response.Header()

Callers 7

TestLoggerFunction · 0.95
TestEchoGroupFunction · 0.45
serveHTTPMethod · 0.45

Calls 1

resetMethod · 0.80

Tested by 6

TestLoggerFunction · 0.76
TestEchoGroupFunction · 0.36