diff --git a/matrix/matrix.go b/matrix/matrix.go index d146eb5..fdbb4e7 100644 --- a/matrix/matrix.go +++ b/matrix/matrix.go @@ -36,8 +36,8 @@ func MatrixServer(w http.ResponseWriter, req *http.Request) { // uses an environment variable for now wellKnownAddr := fmt.Sprintf("%s:8448", config.GetConfig().MatrixWellKnownAddress) if wellKnownAddr == "" { - w.WriteHeader(http.StatusNotFound) l.Debug().Str("path", "matrix/server").Msg("matrix well known address unset") + http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound) return } @@ -56,8 +56,8 @@ func MatrixClient(w http.ResponseWriter, req *http.Request) { wellKnownAddr := config.GetConfig().MatrixWellKnownAddress // no matrix config set if wellKnownAddr == "" { - w.WriteHeader(http.StatusNotFound) l.Debug().Str("path", "matrix/client").Msg("matrix well known address unset") + http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound) return } diff --git a/nostr/nostr.go b/nostr/nostr.go index c86b48c..4d91a2c 100644 --- a/nostr/nostr.go +++ b/nostr/nostr.go @@ -47,7 +47,7 @@ func GetNostrAddr(w http.ResponseWriter, r *http.Request) { err = DB.QueryRow("SELECT pubkey, relays FROM users WHERE id=$1", uid).Scan(&user.Pubkey, &user.Relays) if err != nil { l.Error().Msgf("unable to get user for uid %v: %s", uid, err.Error()) - w.WriteHeader(http.StatusNotFound) + http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound) return } @@ -56,7 +56,7 @@ func GetNostrAddr(w http.ResponseWriter, r *http.Request) { err = DB.Select(&names, "SELECT nip05s.name FROM nip05s JOIN users ON nip05s.owner_id = users.id WHERE nip05s.owner_id = $1", uid) if err != nil { l.Error().Msgf("unable to get user for uid %v: %s", uid, err.Error()) - w.WriteHeader(http.StatusNotFound) + http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound) return } @@ -84,7 +84,7 @@ func GetNostrAddr(w http.ResponseWriter, r *http.Request) { j, err := json.Marshal(ret) if err != nil { l.Error().Msg(err.Error()) - w.WriteHeader(http.StatusNotFound) + http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound) return }