diff options
Diffstat (limited to '')
-rw-r--r-- | form.go | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -12,6 +12,7 @@ var schemaDecoder *schema.Decoder func init() { schemaDecoder = schema.NewDecoder() + schemaDecoder.IgnoreUnknownKeys(true) } type fieldError struct { @@ -34,4 +35,8 @@ func parseForm[T any](r *http.Request, data *T) { if err := schemaDecoder.Decode(data, r.PostForm); err != nil { log.Panic("Decoding form: ", err) } + + if withCsrf, ok := any(data).(WithCsrf); ok { + withCsrf.SetCsrfField(r) + } } |