improve & refactor & return specific error pages

This commit is contained in:
6543 2022-11-07 22:47:03 +01:00
parent 60aefb4bf5
commit 70871e77be
No known key found for this signature in database
GPG key ID: B8BE6D610E61C862
4 changed files with 45 additions and 24 deletions

View file

@ -2,6 +2,7 @@ package gitea
import (
"bytes"
"fmt"
"io"
"net/http"
"time"
@ -55,6 +56,8 @@ func (f FileResponse) createHttpResponse() *http.Response {
}
resp.Header.Set(eTagHeader, f.ETag)
resp.Header.Set(contentTypeHeader, f.MimeType)
resp.Header.Set(contentLengthHeader, fmt.Sprint(len(f.Body)))
resp.Header.Set(pagesCacheIndicator, "true")
return resp
}

View file

@ -27,6 +27,9 @@ const (
defaultBranchCacheKeyPrefix = "defaultBranch"
rawContentCacheKeyPrefix = "rawContent"
// pages server
pagesCacheIndicator = "X-Pages-Cache"
// gitea
giteaObjectTypeHeader = "X-Gitea-Object-Type"
objTypeSymlink = "symlink"