File size: 613 Bytes
8d3471e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package devcapture

import (
	"net/http"

	"ds2api/internal/devcapture"
)

func (h *Handler) getDevCaptures(w http.ResponseWriter, _ *http.Request) {
	store := devcapture.Global()
	writeJSON(w, http.StatusOK, map[string]any{
		"enabled":        store.Enabled(),
		"limit":          store.Limit(),
		"max_body_bytes": store.MaxBodyBytes(),
		"items":          store.Snapshot(),
	})
}

func (h *Handler) clearDevCaptures(w http.ResponseWriter, _ *http.Request) {
	store := devcapture.Global()
	store.Clear()
	writeJSON(w, http.StatusOK, map[string]any{
		"success": true,
		"detail":  "capture logs cleared",
	})
}