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

mendersoftware / mender-server / 1861958901

10 Jun 2025 08:53AM UTC coverage: 65.74%. First build
1861958901

push

gitlab-ci

web-flow
Merge pull request #711 from mendersoftware/MEN-8235

Merge MEN-8235 into main

285 of 347 new or added lines in 13 files covered. (82.13%)

32499 of 49436 relevant lines covered (65.74%)

1.39 hits per line

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

75.0
/backend/services/deviceauth/utils/http.go
1
// Copyright 2021 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 utils
16

17
import (
18
        "io"
19
        "net/http"
20
        "strings"
21

22
        "github.com/pkg/errors"
23
)
24

25
func ReadBodyRaw(r *http.Request) ([]byte, error) {
2✔
26
        if r.Body == nil {
2✔
NEW
27
                return nil, errors.New("empty request body")
×
NEW
28
        }
×
29
        content, err := io.ReadAll(r.Body)
2✔
30
        r.Body.Close()
2✔
31
        if err != nil {
2✔
32
                return nil, err
×
33
        }
×
34

35
        return content, nil
2✔
36
}
37

38
func JoinURL(base, url string) string {
3✔
39
        url = strings.TrimPrefix(url, "/")
3✔
40
        if !strings.HasSuffix(base, "/") {
5✔
41
                base = base + "/"
2✔
42
        }
2✔
43
        return base + url
3✔
44

45
}
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