package web

import (
	"encoding/json"
	"net/http"
)

func Error(w http.ResponseWriter, err string, code int) {
    w.Header().Set("Content-Type", "application/json; charset=utf-8")
    w.Header().Set("X-Content-Type-Options", "nosniff")
    w.WriteHeader(code)
	_ = json.NewEncoder(w).Encode(map[string]any{
		"error": err,
		"status": code,
	})
}

