mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-17 03:43:11 -06:00
Rename writeErrorMessage to writeHTTPMessage
Co-Authored-By: Alex Chen <Cnly@users.noreply.github.com>
This commit is contained in:
parent
c164b92e62
commit
bc12533bc0
|
|
@ -107,7 +107,7 @@ func AuthFallback(
|
||||||
sessionID := req.URL.Query().Get("session")
|
sessionID := req.URL.Query().Get("session")
|
||||||
|
|
||||||
if sessionID == "" {
|
if sessionID == "" {
|
||||||
return writeErrorMessage(w, req,
|
return writeHTTPMessage(w, req,
|
||||||
"Session ID not provided",
|
"Session ID not provided",
|
||||||
http.StatusBadRequest,
|
http.StatusBadRequest,
|
||||||
)
|
)
|
||||||
|
|
@ -186,7 +186,7 @@ func checkRecaptchaEnabled(
|
||||||
req *http.Request,
|
req *http.Request,
|
||||||
) *util.JSONResponse {
|
) *util.JSONResponse {
|
||||||
if !cfg.Matrix.RecaptchaEnabled {
|
if !cfg.Matrix.RecaptchaEnabled {
|
||||||
return writeErrorMessage(w, req,
|
return writeHTTPMessage(w, req,
|
||||||
"Recaptcha login is disabled on this Homeserver",
|
"Recaptcha login is disabled on this Homeserver",
|
||||||
http.StatusBadRequest,
|
http.StatusBadRequest,
|
||||||
)
|
)
|
||||||
|
|
@ -194,8 +194,9 @@ func checkRecaptchaEnabled(
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// writeErrorMessage writes an error response with the given header and message
|
// writeHTTPMessage writes the given header and message to the HTTP response writer.
|
||||||
func writeErrorMessage(
|
// Returns an error JSONResponse obtained through httputil.LogThenError if the writing failed, otherwise nil.
|
||||||
|
func writeHTTPMessage(
|
||||||
w http.ResponseWriter, req *http.Request,
|
w http.ResponseWriter, req *http.Request,
|
||||||
message string, header int,
|
message string, header int,
|
||||||
) *util.JSONResponse {
|
) *util.JSONResponse {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue