github.com/rpdict/ponzu@v0.10.1-0.20190226054626-477f29d6bf5e/system/api/record.go (about) 1 package api 2 3 import ( 4 "net/http" 5 6 "github.com/rpdict/ponzu/system/api/analytics" 7 ) 8 9 // Record wraps a HandlerFunc to record API requests for analytical purposes 10 func Record(next http.HandlerFunc) http.HandlerFunc { 11 return http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { 12 go analytics.Record(req) 13 14 next.ServeHTTP(res, req) 15 }) 16 }