From 21c408f385a110afc0bb35b568b7e02440aa7229 Mon Sep 17 00:00:00 2001 From: "Federico G. Schwindt" Date: Fri, 28 Jun 2024 16:59:54 +0100 Subject: [PATCH] Rename --- fsttest/recorder.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/fsttest/recorder.go b/fsttest/recorder.go index 2283da9..2648b75 100644 --- a/fsttest/recorder.go +++ b/fsttest/recorder.go @@ -15,7 +15,7 @@ type ResponseRecorder struct { Code int HeaderMap fsthttp.Header Body *bytes.Buffer - headersDone bool + headersSent bool } // NewRecorder returns an initialized ResponseRecorder. @@ -29,19 +29,18 @@ func NewRecorder() *ResponseRecorder { // Header returns the response headers to mutate within a handler. func (r *ResponseRecorder) Header() fsthttp.Header { - if !r.headersDone { + if !r.headersSent { return r.HeaderMap } - // Once the send the headers, return a copy so any changes - // are discarded. + // Once sent, return a copy so any changes are discarded. return r.HeaderMap.Clone() } // WriteHeader records the response code. func (r *ResponseRecorder) WriteHeader(code int) { - if !r.headersDone { + if !r.headersSent { r.Code = code - r.headersDone = true + r.headersSent = true } }