• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mendersoftware / reporting / 1571619767

13 Sep 2024 10:52AM UTC coverage: 85.292% (+0.06%) from 85.235%
1571619767

push

gitlab-ci

web-flow
Merge pull request #202 from mzedel/chore/deprecate

Chore/deprecate

2998 of 3515 relevant lines covered (85.29%)

14.21 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/api/http/internal.go
1
// Copyright 2022 Northern.tech AS
2
//
3
//    Licensed under the Apache License, Version 2.0 (the "License");
4
//    you may not use this file except in compliance with the License.
5
//    You may obtain a copy of the License at
6
//
7
//        http://www.apache.org/licenses/LICENSE-2.0
8
//
9
//    Unless required by applicable law or agreed to in writing, software
10
//    distributed under the License is distributed on an "AS IS" BASIS,
11
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
//    See the License for the specific language governing permissions and
13
//    limitations under the License.
14

15
package http
16

17
import (
18
        "net/http"
19

20
        "github.com/gin-gonic/gin"
21

22
        "github.com/mendersoftware/go-lib-micro/rest.utils"
23

24
        "github.com/mendersoftware/reporting/app/reporting"
25
)
26

27
// InternalController contains internal end-points
28
type InternalController struct {
29
        reporting reporting.App
30
}
31

32
// NewInternalController returns a new InternalController
33
func NewInternalController(r reporting.App) *InternalController {
42✔
34
        return &InternalController{
42✔
35
                reporting: r,
42✔
36
        }
42✔
37
}
42✔
38

39
// Alive responds to GET /health/alive
40
func (h InternalController) Alive(c *gin.Context) {
3✔
41
        c.JSON(http.StatusNoContent, nil)
3✔
42
}
3✔
43

44
func (h InternalController) Health(c *gin.Context) {
2✔
45
        err := h.reporting.HealthCheck(c.Request.Context())
2✔
46
        if err != nil {
3✔
47
                rest.RenderError(c, http.StatusInternalServerError, err)
1✔
48
                return
1✔
49
        }
1✔
50
        c.Status(http.StatusNoContent)
1✔
51
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc