diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d1fa675e..a147b7a8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -17,17 +17,11 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-go@v4 with: - go-version: '1.20' - - uses: actions/cache@v3 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-v1-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go-v1- + go-version: "1.20" - name: tests run: scripts/cibuild - name: Generate Foresight test data - run: go test -v -json -coverprofile=coverage.out ./...> ./test-report.json || true + run: go test -v -json -coverprofile=coverage.out ./...> ./test-report.json || true - name: Analyze Test and/or Coverage Results uses: runforesight/foresight-test-kit-action@v1 if: success() || failure() @@ -43,4 +37,4 @@ jobs: with: token: ${{ secrets.CODECOV_TOKEN }} files: coverage.out - flags: micro \ No newline at end of file + flags: micro diff --git a/health/README.md b/health/README.md index e8b708a8..f00d9791 100644 --- a/health/README.md +++ b/health/README.md @@ -19,7 +19,7 @@ Healthy service example (using the [httpie](https://httpie.org/) command line ut http http://localhost:8083/livez HTTP/1.1 200 OK Content-Length: 109 -Content-Type: text/plain; charset=utf-8 +Content-Type: application/json Date: Mon, 17 Jan 2022 23:23:12 GMT { @@ -38,7 +38,7 @@ Unhealthy service: http http://localhost:8083/livez HTTP/1.1 503 Service Unavailable Content-Length: 113 -Content-Type: text/plain; charset=utf-8 +Content-Type: application/json Date: Mon, 17 Jan 2022 23:23:20 GMT { diff --git a/health/handler.go b/health/handler.go index 1d16d849..84bc083d 100644 --- a/health/handler.go +++ b/health/handler.go @@ -10,6 +10,7 @@ import ( // response status is 200 if chk.Check() returns a nil error, 503 otherwise. func Handler(chk Checker) http.HandlerFunc { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json") h, healthy := chk.Check(r.Context()) b, _ := json.Marshal(h) if healthy {