MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / ContentLength

Method ContentLength

storage/reader.go:96–110  ·  view source on GitHub ↗

ContentLength returns the content length of the response.

()

Source from the content-addressed store, hash-verified

94
95// ContentLength returns the content length of the response.
96func (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
113func (r *ObjectReader) Response(req *http.Request) *http.Response {

Callers 1

ResponseMethod · 0.95

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected