MCPcopy Create free account
hub / github.com/imroc/req / doBodyCopy

Method doBodyCopy

transfer.go:390–398  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

388//
389// This function is only intended for use in writeBody.
390func (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

Callers 1

writeBodyMethod · 0.95

Calls 2

getCopyBufFunction · 0.85
putCopyBufFunction · 0.85

Tested by

no test coverage detected