diff --git a/server/gitea/cache.go b/server/gitea/cache.go new file mode 100644 index 0000000..932ff3c --- /dev/null +++ b/server/gitea/cache.go @@ -0,0 +1,12 @@ +package gitea + +type FileResponse struct { + Exists bool + ETag []byte + MimeType string + Body []byte +} + +func (f FileResponse) IsEmpty() bool { + return len(f.Body) != 0 +} diff --git a/server/gitea/client.go b/server/gitea/client.go index 3b9ad6f..943be1f 100644 --- a/server/gitea/client.go +++ b/server/gitea/client.go @@ -23,13 +23,6 @@ type Client struct { contentTimeout time.Duration } -type FileResponse struct { - Exists bool - ETag []byte - MimeType string - Body []byte -} - // TODO: once golang v1.19 is min requirement, we can switch to 'JoinPath()' of 'net/url' package func joinURL(baseURL string, paths ...string) string { p := make([]string, 0, len(paths)) @@ -44,8 +37,6 @@ func joinURL(baseURL string, paths ...string) string { return baseURL + "/" + strings.Join(p, "/") } -func (f FileResponse) IsEmpty() bool { return len(f.Body) != 0 } - func NewClient(giteaRoot, giteaAPIToken string) (*Client, error) { rootURL, err := url.Parse(giteaRoot) giteaRoot = strings.Trim(rootURL.String(), "/")