Skip to content
Snippets Groups Projects
Commit abb5aabf authored by ave's avatar ave
Browse files

Merge branch 'implement-content-length' into 'main'

Implement Content-Length

Closes #3

See merge request flow3r/api!5
parents 21419e02 cb2c5221
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,7 @@ import (
"path"
"regexp"
"strings"
"strconv"
"time"
"github.com/go-git/go-git/v5"
......@@ -705,6 +706,7 @@ func (s *server) handleAppTargz(w http.ResponseWriter, r *http.Request) {
for _, app := range apps {
if app.repository == fmt.Sprintf("%s/%s", orga, repo) {
w.Header().Add("Content-Type", "application/x-gzip")
w.Header().Add("Content-Length", strconv.Itoa(len(app.appInfo.targz)))
w.Write(app.appInfo.targz)
return
}
......
......@@ -10,6 +10,7 @@ import (
"net/http"
"regexp"
"strings"
"strconv"
)
func (s *server) cacheTarball(rel *GLRelease, data io.Reader) error {
......@@ -49,6 +50,7 @@ func (s *server) serveMirroredFile(w http.ResponseWriter, r *http.Request, rel *
b := s.cache[rel.TagName][artifact]
s.cacheMu.RUnlock()
w.Header().Add("Content-Type", "application/octet-stream")
w.Header().Add("Content-Length", strconv.Itoa(len(b)))
w.Write(b)
return
}
......@@ -103,6 +105,7 @@ func (s *server) serveMirroredFile(w http.ResponseWriter, r *http.Request, rel *
b := s.cache[rel.TagName][artifact]
s.cacheMu.RUnlock()
w.Header().Add("Content-Type", "application/octet-stream")
w.Header().Add("Content-Length", strconv.Itoa(len(b)))
w.Write(b)
return
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment