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)
| 139 | // with `Echo#AcquireContext()` and `Echo#ReleaseContext()`. |
| 140 | // See `Echo#ServeHTTP()` |
| 141 | func (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 | |
| 159 | func (c *Context) writeContentType(value string) { |
| 160 | header := c.response.Header() |