blob: 93d4aaf52b948d2cf9eb534cd941c7ee1be9e703 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
package api
import (
"net/http"
"github.com/ponzu-cms/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)
})
}
|