Skip to content

Commit 3821a21

Browse files
mmatczukChoraden
authored andcommitted
martian: handler, do not copy http.NoBody
1 parent fdba2f8 commit 3821a21

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

internal/martian/handler.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ func addTrailerHeader(rw http.ResponseWriter, tr http.Header) int {
5454
}
5555

5656
func copyBody(w io.Writer, body io.ReadCloser) error {
57+
if body == http.NoBody {
58+
return nil
59+
}
60+
5761
bufp := copyBufPool.Get().(*[]byte) //nolint:forcetypeassert // It's *[]byte.
5862
buf := *bufp
5963
defer copyBufPool.Put(bufp)

0 commit comments

Comments
 (0)