top

Package httprs provides a ReadSeeker for http.Response.Body.

Usage :

resp, err := http.Get(url)
rs := httprs.NewHttpReadSeeker(resp)
defer rs.Close()
io.ReadFull(rs, buf) // reads the first bytes from the response body
rs.Seek(1024, 0) // moves the position, but does no range request
io.ReadFull(rs, buf) // does a range request and reads from the response body

If you want use a specific http.Client for additional range requests :

rs := httprs.NewHttpReadSeeker(resp, client)

Test imports 1 package(s) ΒΆ

  1. github.com/smartystreets/goconvey/convey