blob: 623c506dd6e4c24f649a2df06b0c45d60351d6fe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
package api
import (
"net/http"
"github.com/haturatu/ponzu/system/api/analytics"
)
// Record wraps a HandlerFunc to record API requests for analytical purposes
func Record(next http.HandlerFunc) http.HandlerFunc {
return http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
go analytics.Record(req)
next.ServeHTTP(res, req)
})
}
|