MCPcopy Create free account
hub / github.com/cloud-native-go/examples / loggingMiddleware

Function loggingMiddleware

ch05/ch05_07/service.go:31–36  ·  view source on GitHub ↗
(next http.Handler)

Source from the content-addressed store, hash-verified

29var transact *TransactionLogger
30
31func loggingMiddleware(next http.Handler) http.Handler {
32 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
33 log.Println(r.Method, r.RequestURI)
34 next.ServeHTTP(w, r)
35 })
36}
37
38func notAllowedHandler(w http.ResponseWriter, r *http.Request) {
39 http.Error(w, "Not Allowed", http.StatusMethodNotAllowed)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected