doBodyCopy wraps a copy operation, with any resulting error also being saved in bodyReadError. This function is only intended for use in writeBody.
(dst io.Writer, src io.Reader)
| 388 | // |
| 389 | // This function is only intended for use in writeBody. |
| 390 | func (t *transferWriter) doBodyCopy(dst io.Writer, src io.Reader) (n int64, err error) { |
| 391 | buf := getCopyBuf() |
| 392 | defer putCopyBuf(buf) |
| 393 | n, err = io.CopyBuffer(dst, src, buf) |
| 394 | if err != nil && err != io.EOF { |
| 395 | t.bodyReadError = err |
| 396 | } |
| 397 | return |
| 398 | } |
| 399 | |
| 400 | // unwrapBody unwraps the body's inner reader if it's a |
| 401 | // nopCloser. This is to ensure that body writes sourced from local |
no test coverage detected