1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-07-22 17:18:33 +00:00

Merge pull request '[v7.0/forgejo] Fix #3030 add Cache-Control header for health-check' (#3074) from bp-v7.0/forgejo-323d7ad-84f5115-d2ff8f8-b210a3e into v7.0/forgejo

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3074
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
This commit is contained in:
Earl Warren 2024-04-06 09:55:19 +00:00
commit 1065ee4a60
2 changed files with 47 additions and 21 deletions

View file

@ -0,0 +1,25 @@
package integration
import (
"net/http"
"testing"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/routers/web/healthcheck"
"code.gitea.io/gitea/tests"
"github.com/stretchr/testify/assert"
)
func TestApiHeatlhCheck(t *testing.T) {
defer tests.PrepareTestEnv(t)()
req := NewRequest(t, "GET", "/api/healthz")
resp := MakeRequest(t, req, http.StatusOK)
assert.Contains(t, resp.Header().Values("Cache-Control"), "no-store")
var status healthcheck.Response
DecodeJSON(t, resp, &status)
assert.Equal(t, healthcheck.Pass, status.Status)
assert.Equal(t, setting.AppName, status.Description)
}