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

mishankov / platforma / 18816060973

26 Oct 2025 09:30AM UTC coverage: 9.617% (+0.04%) from 9.581%
18816060973

Pull #9

github

mishankov
ci: add additional linters and enforce HTTP method constants in tests

- Add tagliatelle, testableexamples, testpackage, thelper, tparallel, unconvert, unparam, unused, and usestdlibvars linters to golangci configuration
- Configure tagliatelle to enforce camelCase for JSON tags
- Replace string literals with http.Method constants in test files for improved code quality and consistency
- Update HTTP method usage in auth middleware and httpclient tests to use standard library constants
Pull Request #9: Linter configuration

11 of 42 new or added lines in 7 files covered. (26.19%)

69 existing lines in 7 files now uncovered.

98 of 1019 relevant lines covered (9.62%)

0.33 hits per line

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

83.87
/httpclient/httpclient.go
1
package httpclient
2

3
import (
4
        "net/http"
5
        "strings"
6
        "time"
7

8
        "github.com/mishankov/platforma/log"
9
)
10

11
type Client struct {
12
        client *http.Client
13
}
14

15
func New(timeout time.Duration) *Client {
3✔
16
        c := &Client{&http.Client{
3✔
17
                Timeout: timeout,
3✔
18
        }}
3✔
19

3✔
20
        return c
3✔
21
}
3✔
22

23
func (c *Client) Do(req *http.Request) (*http.Response, error) {
3✔
24
        log.DebugContext(req.Context(), "request started", "url", req.URL, "headers", maskedHeaders(req.Header))
3✔
25
        resp, err := c.client.Do(req)
3✔
26
        if err != nil {
6✔
27
                log.DebugContext(req.Context(), "request failed", "error", err)
3✔
28
                return nil, err
3✔
29
        }
3✔
30
        log.DebugContext(req.Context(), "request made", "status", resp.Status, "headers", maskedHeaders(resp.Header))
3✔
31

3✔
32
        return resp, err
3✔
33
}
34

35
func maskedHeaders(headers http.Header) http.Header {
3✔
36
        newHeaders := http.Header{}
3✔
37
        for hn, hvs := range headers {
6✔
38
                if strings.ToLower(hn) == "authorization" {
3✔
UNCOV
39
                        for _, hv := range hvs {
×
40
                                if strings.HasPrefix(strings.ToLower(hv), "basic ") || strings.HasPrefix(strings.ToLower(hv), "bearer ") {
×
41
                                        newHeaders.Add(hn, strings.Split(hv, " ")[0]+" ***")
×
42
                                        continue
×
43
                                }
UNCOV
44
                                newHeaders.Add(hn, hv)
×
45
                        }
46
                } else {
3✔
47
                        for _, hv := range hvs {
6✔
48
                                newHeaders.Add(hn, hv)
3✔
49
                        }
3✔
50
                }
51
        }
52

53
        return newHeaders
3✔
54
}
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

© 2026 Coveralls, Inc