22 lines
385 B
Go
22 lines
385 B
Go
|
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)
|
||
|
}
|