diff options
author | Steve Manuel <nilslice@gmail.com> | 2017-02-13 09:18:36 -0800 |
---|---|---|
committer | Steve Manuel <nilslice@gmail.com> | 2017-02-13 09:18:36 -0800 |
commit | f47826071f1e6d7b048d1304d8435a347f9b412a (patch) | |
tree | 1990862ba77dfce49325cc39c017a76a97c366c5 /system/api/record.go | |
parent | 6ea648ae4306e64f5562ca363e0cdea494ba8d46 (diff) |
adding item.Omittable interface for field-level omission of data in responses, implementation in handler and separating source into individual files for other interface impls
Diffstat (limited to 'system/api/record.go')
-rw-r--r-- | system/api/record.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/system/api/record.go b/system/api/record.go new file mode 100644 index 0000000..93d4aaf --- /dev/null +++ b/system/api/record.go @@ -0,0 +1,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) + }) +} |