Support x-www-form-urlencoded form-data

This commit is contained in:
2023-06-18 03:46:01 +02:00
parent 860e540de1
commit c46190c3fc
2 changed files with 5 additions and 0 deletions

View File

@@ -263,6 +263,10 @@ func (app *Application) StartRequest(g *gin.Context, uri any, query any, body an
if err := g.ShouldBindWith(form, binding.Form); err != nil {
return nil, langext.Ptr(ginresp.APIError(g, 400, apierr.BINDFAIL_BODY_PARAM, "Failed to read multipart-form", err))
}
} else if g.ContentType() == "application/x-www-form-urlencoded" {
if err := g.ShouldBindWith(form, binding.Form); err != nil {
return nil, langext.Ptr(ginresp.APIError(g, 400, apierr.BINDFAIL_BODY_PARAM, "Failed to read urlencoded-form", err))
}
} else {
if !ignoreWrongContentType {
return nil, langext.Ptr(ginresp.APIError(g, 400, apierr.BINDFAIL_BODY_PARAM, "missing form body", nil))