mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-04-25 14:26:58 +00:00
improve & refactor & return specific error pages
This commit is contained in:
parent
60aefb4bf5
commit
70871e77be
4 changed files with 45 additions and 24 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -27,6 +27,9 @@ const (
|
|||
defaultBranchCacheKeyPrefix = "defaultBranch"
|
||||
rawContentCacheKeyPrefix = "rawContent"
|
||||
|
||||
// pages server
|
||||
pagesCacheIndicator = "X-Pages-Cache"
|
||||
|
||||
// gitea
|
||||
giteaObjectTypeHeader = "X-Gitea-Object-Type"
|
||||
objTypeSymlink = "symlink"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue