diff --git a/http/interceptor.go b/http/interceptor.go index a7b616ab5..2f3352e97 100644 --- a/http/interceptor.go +++ b/http/interceptor.go @@ -109,7 +109,7 @@ func (i *rwInterceptor) Header() http.Header { } func (i *rwInterceptor) ReadFrom(r io.Reader) (n int64, err error) { - return io.Copy(i, r) + return io.Copy(struct{ io.Writer }{i}, r) } func (i *rwInterceptor) Flush() { diff --git a/http/interceptor_test.go b/http/interceptor_test.go index e4da8e700..d232996bf 100644 --- a/http/interceptor_test.go +++ b/http/interceptor_test.go @@ -214,6 +214,11 @@ func TestReadFrom(t *testing.T) { t.Errorf("unexpected error: %v", err) } + _, err = rw.(io.ReaderFrom).ReadFrom(struct{ io.Reader }{bytes.NewBuffer([]byte("hello world"))}) + if err != nil { + t.Errorf("unexpected error: %v", err) + } + err = responseProcessor(tx, req) if err != nil { t.Errorf("unexpected error: %v", err)