v0.0.237 parse application/x-www-form-urlencoded in ginext

This commit is contained in:
Mike Schwörer 2023-08-09 19:35:01 +02:00
parent 029b408749
commit f0881c9fd6
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
2 changed files with 10 additions and 2 deletions

View File

@ -92,6 +92,14 @@ func (pctx PreContext) Start() (*AppContext, *gin.Context, *HTTPResponse) {
Build()
return nil, nil, langext.Ptr(Error(err))
}
} else if pctx.ginCtx.ContentType() == "application/x-www-form-urlencoded" {
if err := pctx.ginCtx.ShouldBindWith(pctx.form, binding.Form); err != nil {
err = exerr.Wrap(err, "Failed to read urlencoded-form").
WithType(exerr.TypeBindFailFormData).
Str("struct_type", fmt.Sprintf("%T", pctx.form)).
Build()
return nil, nil, langext.Ptr(Error(err))
}
} else {
err := exerr.New(exerr.TypeBindFailFormData, "missing form body").
Str("struct_type", fmt.Sprintf("%T", pctx.form)).

View File

@ -1,5 +1,5 @@
package goext
const GoextVersion = "0.0.236"
const GoextVersion = "0.0.237"
const GoextVersionTimestamp = "2023-08-09T17:48:06+0200"
const GoextVersionTimestamp = "2023-08-09T19:35:01+0200"