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

mishankov / platforma / 18907218718

29 Oct 2025 12:03PM UTC coverage: 21.048% (+0.5%) from 20.552%
18907218718

Pull #14

github

mishankov
Add healthcheck test for HTTP server
Pull Request #14: Httpserver cleanup

3 of 8 new or added lines in 3 files covered. (37.5%)

22 existing lines in 2 files now uncovered.

237 of 1126 relevant lines covered (21.05%)

0.24 hits per line

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

0.0
/httpserver/handlergroup.go
1
package httpserver
2

3
import (
4
        "net/http"
5
)
6

7
// HandlerGroup represents a group of HTTP handlers that share common middlewares.
8
type HandlerGroup struct {
9
        mux         *http.ServeMux
10
        middlewares []Middleware
11
}
12

13
// NewHandlerGroup creates a new HandlerGroup with an initialized http.ServeMux.
14
func NewHandlerGroup() *HandlerGroup {
×
15
        return &HandlerGroup{mux: http.NewServeMux()}
×
16
}
×
17

18
// Use adds a middleware to the HandlerGroup's middleware chain.
19
func (hg *HandlerGroup) Use(middlewares ...Middleware) {
×
20
        hg.middlewares = append(hg.middlewares, middlewares...)
×
21
}
×
22

23
// UseFunc adds a function as a middleware to the HandlerGroup's middleware chain.
24
func (hg *HandlerGroup) UseFunc(middlewareFuncs ...func(http.Handler) http.Handler) {
×
25
        for _, middlewareFunc := range middlewareFuncs {
×
26
                hg.middlewares = append(hg.middlewares, MiddlewareFunc(middlewareFunc))
×
27
        }
×
28
}
29

30
// Handle registers an http.Handler for the given pattern, applying all
31
// middlewares in the HandlerGroup's chain.
32
func (hg *HandlerGroup) Handle(pattern string, handler http.Handler) {
×
33
        hg.mux.Handle(pattern, handler)
×
UNCOV
34
}
×
35

36
// HandleFunc registers an http.HandlerFunc for the given pattern, applying all
37
// middlewares in the HandlerGroup's chain.
38
func (hg *HandlerGroup) HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request)) {
×
UNCOV
39
        hg.mux.Handle(pattern, http.HandlerFunc(handler))
×
40
}
×
41

42
// ServeHTTP implements the http.Handler interface, allowing HandlerGroup to
43
// be used as an HTTP handler itself.
44
func (hg *HandlerGroup) ServeHTTP(w http.ResponseWriter, r *http.Request) {
×
UNCOV
45
        wrappedMux := wrapHandlerInMiddleware(hg.mux, hg.middlewares)
×
UNCOV
46
        wrappedMux.ServeHTTP(w, r)
×
47
}
×
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