switch to atreugo
1 file changed, 5 insertions(+), 9 deletions(-)
changed files
M routes/util.go → routes/util.go
@@ -3,7 +3,6 @@ import ( "bufio" "log" - "net/http" "os" "path/filepath" "slices"@@ -13,6 +12,7 @@ "alin.ovh/elgit/data" "alin.ovh/elgit/git" securejoin "github.com/cyphar/filepath-securejoin" "github.com/dimfeld/httptreemux/v5" + "github.com/savsgio/atreugo/v11" ) func isGoModule(gr *git.Repo) bool {@@ -114,15 +114,11 @@ return entries } -func setContentDisposition(w http.ResponseWriter, name string) { +func setContentDisposition(rc *atreugo.RequestCtx, name string) { h := "inline; filename=\"" + name + "\"" - w.Header().Add("Content-Disposition", h) -} - -func setGZipMIME(w http.ResponseWriter) { - setMIME(w, "application/gzip") + rc.Response.Header.Set("Content-Disposition", h) } -func setMIME(w http.ResponseWriter, mime string) { - w.Header().Add("Content-Type", mime) +func setGZipMIME(rc *atreugo.RequestCtx) { + rc.SetContentType("application/gzip") }