MCPcopy Create free account
hub / github.com/0xUnixIO/pulse / writeJSON

Function writeJSON

internal/payment/shop.go:264–270  ·  view source on GitHub ↗
(w http.ResponseWriter, status int, payload any)

Source from the content-addressed store, hash-verified

262}
263
264func writeJSON(w http.ResponseWriter, status int, payload any) {
265 w.Header().Set("Content-Type", "application/json; charset=utf-8")
266 w.WriteHeader(status)
267 if err := json.NewEncoder(w).Encode(payload); err != nil {
268 log.Printf("payment: write json: %v", err)
269 }
270}
271
272func writeJSONError(w http.ResponseWriter, status int, message string) {
273 writeJSON(w, status, map[string]string{"error": message})

Callers 3

listPlansHandlerMethod · 0.70
createCheckoutHandlerMethod · 0.70
writeJSONErrorFunction · 0.70

Calls 1

WriteHeaderMethod · 0.80

Tested by

no test coverage detected