diff options
Diffstat (limited to 'system/api')
-rw-r--r-- | system/api/analytics/batch.go | 4 | ||||
-rw-r--r-- | system/api/handlers.go | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/system/api/analytics/batch.go b/system/api/analytics/batch.go index c4a60db..68ffd65 100644 --- a/system/api/analytics/batch.go +++ b/system/api/analytics/batch.go @@ -19,7 +19,7 @@ func batchInsert(requests chan apiRequest) error { } err := store.Update(func(tx *bolt.Tx) error { - b, err := tx.CreateBucketIfNotExists([]byte("requests")) + b, err := tx.CreateBucketIfNotExists([]byte("__requests")) if err != nil { return err } @@ -64,7 +64,7 @@ func batchPrune(threshold time.Duration) error { // iterate through all request data err := store.Update(func(tx *bolt.Tx) error { - b := tx.Bucket([]byte("requests")) + b := tx.Bucket([]byte("__requests")) err := b.ForEach(func(k, v []byte) error { var r apiRequest diff --git a/system/api/handlers.go b/system/api/handlers.go index 8a1517b..c238ca9 100644 --- a/system/api/handlers.go +++ b/system/api/handlers.go @@ -200,14 +200,14 @@ func SendJSON(res http.ResponseWriter, j map[string]interface{}) { // CORS wraps a HandleFunc to response to OPTIONS requests properly func CORS(next http.HandlerFunc) http.HandlerFunc { - return http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + return db.CacheControl(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { if req.Method == http.MethodOptions { SendPreflight(res) return } next.ServeHTTP(res, req) - }) + })) } // Record wraps a HandleFunc to record API requests for analytical purposes |