mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-24 09:18:31 +02:00
refactor(http): remove and replace error helpers with standard http.Error
This commit is contained in:
@@ -32,7 +32,7 @@ func PreRequest(p Provider, w http.ResponseWriter, r *http.Request) (proceed boo
|
||||
}
|
||||
|
||||
if !gphttp.GetAccept(r.Header).AcceptHTML() {
|
||||
gphttp.Forbidden(w, "Captcha is required")
|
||||
http.Error(w, "Captcha is required", http.StatusForbidden)
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -45,7 +45,9 @@ func PreRequest(p Provider, w http.ResponseWriter, r *http.Request) (proceed boo
|
||||
http.Redirect(w, r, r.URL.Path, http.StatusFound)
|
||||
return false
|
||||
}
|
||||
gphttp.Unauthorized(w, err.Error())
|
||||
|
||||
log.Warn().Err(err).Str("url", r.URL.String()).Str("remote_addr", r.RemoteAddr).Msg("failed to verify captcha")
|
||||
http.Error(w, "Failed to verify captcha", http.StatusUnauthorized)
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user