feat: add middleware.cache
This commit is contained in:
21
internal/model/writer.go
Normal file
21
internal/model/writer.go
Normal file
@ -0,0 +1,21 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"github.com/loveuer/nf"
|
||||
)
|
||||
|
||||
type CustomResponseWriter struct {
|
||||
nf.ResponseWriter
|
||||
Body *bytes.Buffer
|
||||
}
|
||||
|
||||
func (w CustomResponseWriter) Write(b []byte) (int, error) {
|
||||
w.Body.Write(b)
|
||||
return w.ResponseWriter.Write(b)
|
||||
}
|
||||
|
||||
func (w CustomResponseWriter) WriteString(s string) (int, error) {
|
||||
w.Body.WriteString(s)
|
||||
return w.ResponseWriter.WriteString(s)
|
||||
}
|
Reference in New Issue
Block a user