mirror of
https://github.com/SecurityBrewery/catalyst.git
synced 2025-12-06 23:32:47 +01:00
17 lines
414 B
Go
17 lines
414 B
Go
package auth
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
)
|
|
|
|
func unauthorizedJSON(w http.ResponseWriter, msg string) {
|
|
errorJSON(w, http.StatusUnauthorized, msg)
|
|
}
|
|
|
|
func errorJSON(w http.ResponseWriter, status int, msg string) {
|
|
w.WriteHeader(status)
|
|
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
|
|
_, _ = fmt.Fprintf(w, `{"status": %d, "error": %q, "message": %q}`, status, http.StatusText(status), msg)
|
|
}
|