for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
package srv
import (
"encoding/json"
"net/http"
)
func RespondOK(data any, w http.ResponseWriter, _ *http.Request) {
w.Header().Set("Content-Type", "application/json; charset=utf-8")
w.WriteHeader(http.StatusOK)
_ = json.NewEncoder(w).Encode(data)
}