getURLParam() was made into a private module func.
This commit is contained in:
parent
ea9877f6c4
commit
6ab62fc43b
@ -30,7 +30,7 @@ func (h *CaptchaHandlers) New(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (h *CaptchaHandlers) Image(w http.ResponseWriter, r *http.Request) {
|
||||
captchaID := captcha.ID(GetURLParam(r, "captcha"))
|
||||
captchaID := captcha.ID(getURLParam(r, "captcha"))
|
||||
captchaStyle := r.URL.Query().Get("style")
|
||||
|
||||
captchaImage := inmemdb.Image(captchaID, captchaStyle)
|
||||
@ -45,7 +45,7 @@ func (h *CaptchaHandlers) Image(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (h *CaptchaHandlers) Solve(w http.ResponseWriter, r *http.Request) {
|
||||
captchaID := captcha.ID(GetURLParam(r, "captcha"))
|
||||
captchaID := captcha.ID(getURLParam(r, "captcha"))
|
||||
|
||||
r.ParseForm()
|
||||
answer := captcha.Answer(r.FormValue("answer"))
|
||||
@ -59,7 +59,7 @@ func (h *CaptchaHandlers) Solve(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (h *CaptchaHandlers) IsSolved(w http.ResponseWriter, r *http.Request) {
|
||||
captchaID := captcha.ID(GetURLParam(r, "captcha"))
|
||||
captchaID := captcha.ID(getURLParam(r, "captcha"))
|
||||
isJustRemove := r.URL.Query().Has("remove")
|
||||
|
||||
if isJustRemove {
|
||||
|
@ -40,8 +40,8 @@ func (s *HttpServer) SetNotFoundHandler(handler http.HandlerFunc) {
|
||||
s.router.NotFound = handler
|
||||
}
|
||||
|
||||
// GetURLParam wrapper around underlying router for getting URL parameters.
|
||||
func GetURLParam(r *http.Request, param string) string {
|
||||
// getURLParam wrapper around underlying router for getting URL parameters.
|
||||
func getURLParam(r *http.Request, param string) string {
|
||||
return httprouter.ParamsFromContext(r.Context()).ByName(param)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user