fix(04-CR-01): add r.ParseForm() to TaskCreateHandler and TaskUpdateHandler
Both handlers were missing the mandatory ParseForm call before reading PostFormValue. This caused gorilla/csrf (which reads the body for CSRF token validation) to consume the body, leaving PostFormValue to return empty strings. TaskReorderHandler was used as the correct reference. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
142ca547ea
commit
e97f4988bd
1 changed files with 10 additions and 0 deletions
|
|
@ -129,6 +129,11 @@ func TaskCreateHandler(deps TasksDeps) http.HandlerFunc {
|
|||
}
|
||||
ctx := r.Context()
|
||||
|
||||
if err := r.ParseForm(); err != nil {
|
||||
http.Error(w, "bad request", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
title := strings.TrimSpace(r.PostFormValue("title"))
|
||||
statusStr := r.PostFormValue("status")
|
||||
status := parseTaskStatus(statusStr)
|
||||
|
|
@ -318,6 +323,11 @@ func TaskUpdateHandler(deps TasksDeps) http.HandlerFunc {
|
|||
}
|
||||
ctx := r.Context()
|
||||
|
||||
if err := r.ParseForm(); err != nil {
|
||||
http.Error(w, "bad request", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
title := strings.TrimSpace(r.PostFormValue("title"))
|
||||
description := r.PostFormValue("description")
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue