+------------------------------------------------------------+ | Advanced: Response Recorder | +------------------------------------------------------------+ Record transforms the context's basic and direct responseWriter to a *ResponseRecorder which can be used to res
()
| 6055 | // which can be used to reset the body, reset headers, get the body, |
| 6056 | // get & set the status code at any time and more. |
| 6057 | func (ctx *Context) Record() { |
| 6058 | switch w := ctx.writer.(type) { |
| 6059 | case *ResponseRecorder: |
| 6060 | default: |
| 6061 | recorder := AcquireResponseRecorder() |
| 6062 | recorder.BeginRecord(w) |
| 6063 | ctx.ResetResponseWriter(recorder) |
| 6064 | } |
| 6065 | } |
| 6066 | |
| 6067 | // Recorder returns the context's ResponseRecorder |
| 6068 | // if not recording then it starts recording and returns the new context's ResponseRecorder |