1
0
mirror of https://github.com/coalaura/whiskr.git synced 2025-09-08 17:06:42 +00:00
Files
whiskr/http.go
2025-08-05 03:56:23 +02:00

14 lines
226 B
Go

package main
import (
"encoding/json"
"net/http"
)
func RespondJson(w http.ResponseWriter, code int, data any) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(code)
json.NewEncoder(w).Encode(data)
}