ContentLength returns the content length of the response.
()
| 94 | |
| 95 | // ContentLength returns the content length of the response. |
| 96 | func (r *ObjectReader) ContentLength() int64 { |
| 97 | if r.contentLength > 0 { |
| 98 | return r.contentLength |
| 99 | } |
| 100 | |
| 101 | h := r.Headers.Get(httpheaders.ContentLength) |
| 102 | if len(h) > 0 { |
| 103 | p, err := strconv.ParseInt(h, 10, 64) |
| 104 | if err != nil { |
| 105 | return p |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | return -1 |
| 110 | } |
| 111 | |
| 112 | // Response converts Reader to http.Response |
| 113 | func (r *ObjectReader) Response(req *http.Request) *http.Response { |