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

mendersoftware / mender-server / 1900805255

01 Jul 2025 05:31PM UTC coverage: 66.222% (+0.5%) from 65.694%
1900805255

Pull #774

gitlab-ci

web-flow
chore: bump pillow from 11.2.1 to 11.3.0 in /backend/tests

Bumps [pillow](https://github.com/python-pillow/Pillow) from 11.2.1 to 11.3.0.
- [Release notes](https://github.com/python-pillow/Pillow/releases)
- [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst)
- [Commits](https://github.com/python-pillow/Pillow/compare/11.2.1...11.3.0)

---
updated-dependencies:
- dependency-name: pillow
  dependency-version: 11.3.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #774: chore: bump pillow from 11.2.1 to 11.3.0 in /backend/tests

29486 of 44526 relevant lines covered (66.22%)

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 {
4✔
15
        return Middleware("application/json")
4✔
16
}
4✔
17

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

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

31
        return func(c *gin.Context) {
8✔
32
                if c.Request.ContentLength > 0 {
8✔
33
                        contentType, _, err := mime.ParseMediaType(c.GetHeader("Content-Type"))
4✔
34
                        if err != nil {
4✔
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) {
4✔
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