Commits

Miki Tebeka  committed b47d4d7

Return io.ReadCloser and close it

  • Participants
  • Parent commits c713ada

Comments (0)

Files changed (1)

 
 type Resource interface {
 	Name() string
-	Open() (io.Reader, error)
+	Open() (io.ReadCloser, error)
 	Size() int64
 	ModTime() time.Time
 }
 	return rsc.entry.Name
 }
 
-func (rsc *resource) Open() (io.Reader, error) {
+func (rsc *resource) Open() (io.ReadCloser, error) {
 	return rsc.entry.Open()
 }
 
 	w.Header().Set("Last-Modified", rsc.ModTime().UTC().Format(http.TimeFormat))
 
 	io.Copy(w, rdr)
+	rdr.Close()
 }
 
 // Get returns the named resource (nil if not found)