()
| 1814 | } |
| 1815 | |
| 1816 | func (brc bodyReadCloser) Close() error { |
| 1817 | // Inside this package this will be set to nil for fully-buffered |
| 1818 | // requests due to the possibility of retrial. |
| 1819 | if brc.buf != nil { |
| 1820 | bufPool.Put(brc.buf) |
| 1821 | } |
| 1822 | // For fully-buffered bodies, body is nil, so Close is a no-op. |
| 1823 | if brc.body != nil { |
| 1824 | return brc.body.Close() |
| 1825 | } |
| 1826 | return nil |
| 1827 | } |
| 1828 | |
| 1829 | // bufPool is used for buffering requests and responses. |
| 1830 | var bufPool = sync.Pool{ |
no outgoing calls