ultone/internal/model/writer.go

22 lines
385 B
Go
Raw Normal View History

2024-07-25 17:31:57 +08:00
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)
}