feat(botfilter): add statusRecorder.ReadFrom

This commit is contained in:
hoelee committed 2026-06-16 08:08:00 +08:00
1 parent 03fd43820a
commit 146412ce33
1 file changed
+9
+9
View File
@@ -154,3 +154,12 @@ func (r *statusRecorder) Push(target string, options *http.PushOptions) error {
return pusher.Push(target, options)
}
func (r *statusRecorder) ReadFrom(source io.Reader) (int64, error) {
if r.status == 0 {
r.status = http.StatusOK
}
if readerFrom, ok := r.ResponseWriter.(io.ReaderFrom); ok {
return readerFrom.ReadFrom(source)
}
return io.Copy(struct{ io.Writer }{Writer: r.ResponseWriter}, source)
}