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

mendersoftware / mender-server / 1961830404

01 Aug 2025 06:29PM UTC coverage: 65.815% (+0.3%) from 65.555%
1961830404

Pull #849

gitlab-ci

web-flow
chore: bump the backend-docker-dependencies group across 10 directories with 2 updates

Bumps the backend-docker-dependencies group with 2 updates in the /backend/services/create-artifact-worker directory: golang and alpine.
Bumps the backend-docker-dependencies group with 1 update in the /backend/services/deployments directory: golang.
Bumps the backend-docker-dependencies group with 1 update in the /backend/services/deviceauth directory: golang.
Bumps the backend-docker-dependencies group with 1 update in the /backend/services/deviceconfig directory: golang.
Bumps the backend-docker-dependencies group with 1 update in the /backend/services/deviceconnect directory: golang.
Bumps the backend-docker-dependencies group with 1 update in the /backend/services/inventory directory: golang.
Bumps the backend-docker-dependencies group with 1 update in the /backend/services/iot-manager directory: golang.
Bumps the backend-docker-dependencies group with 1 update in the /backend/services/reporting directory: golang.
Bumps the backend-docker-dependencies group with 1 update in the /backend/services/useradm directory: golang.
Bumps the backend-docker-dependencies group with 1 update in the /backend/services/workflows directory: golang.


Updates `golang` from 1.24.4 to 1.24.5

Updates `alpine` from 3.22.0 to 3.22.1

Updates `golang` from 1.24.4 to 1.24.5

Updates `golang` from 1.24.4 to 1.24.5

Updates `golang` from 1.24.4 to 1.24.5

Updates `golang` from 1.24.4 to 1.24.5

Updates `golang` from 1.24.4 to 1.24.5

Updates `golang` from 1.24.4 to 1.24.5

Updates `golang` from 1.24.4 to 1.24.5

Updates `golang` from 1.24.4 to 1.24.5

Updates `golang` from 1.24.4 to 1.24.5

---
updated-dependencies:
- dependency-name: golang
  dependency-version: 1.24.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: backend-docker-dependencies
- dependency-name: alpine
  dependency-version: 3.22.1
  dependency-type: direct:production... (continued)
Pull Request #849: chore: bump the backend-docker-dependencies group across 10 directories with 2 updates

29335 of 44572 relevant lines covered (65.81%)

1.44 hits per line

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

53.33
/backend/pkg/contenttype/middleware.go
1
package contenttype
2

3
import (
4
        "mime"
5
        "net/http"
6
        "slices"
7

8
        "github.com/gin-gonic/gin"
9
        "github.com/pkg/errors"
10

11
        "github.com/mendersoftware/mender-server/pkg/rest.utils"
12
)
13

14
func CheckJSON() gin.HandlerFunc {
5✔
15
        return Middleware("application/json")
5✔
16
}
5✔
17

18
func Middleware(contentTypes ...string) gin.HandlerFunc {
5✔
19
        if len(contentTypes) == 0 {
5✔
20
                panic("contenttype.Middleware initialized with no parameters")
×
21
        }
22

23
        errMsg := "Bad Content-Type, expected "
5✔
24
        for i, ctype := range contentTypes {
10✔
25
                if i > 0 {
7✔
26
                        errMsg += ", "
2✔
27
                }
2✔
28
                errMsg += "'" + ctype + "'"
5✔
29
        }
30

31
        return func(c *gin.Context) {
10✔
32
                if c.Request.ContentLength > 0 {
10✔
33
                        contentType, _, err := mime.ParseMediaType(c.GetHeader("Content-Type"))
5✔
34
                        if err != nil {
5✔
35
                                rest.RenderError(c,
×
36
                                        http.StatusBadRequest,
×
37
                                        errors.WithMessage(err, "Invalid value for Content-Type header"),
×
38
                                )
×
39
                                c.Abort()
×
40
                                return
×
41
                        }
×
42

43
                        if !slices.Contains(contentTypes, contentType) {
5✔
44
                                rest.RenderError(c,
×
45
                                        http.StatusUnsupportedMediaType,
×
46
                                        errors.New(errMsg),
×
47
                                )
×
48
                                c.Abort()
×
49
                        }
×
50
                }
51
        }
52
}
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