feat(botfilter): add statusRecorder.ReadFrom
This commit is contained in:
1 parent
df84c1db8c
commit
f684931fc4
1 file changed
+9
@@ -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)
|
||||
}
|
||||
Reference in new issue
Block a user