From c46190c3fcf48f1925a062b553fee3fbdfb83c99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Sun, 18 Jun 2023 03:46:01 +0200 Subject: [PATCH] Support x-www-form-urlencoded form-data --- scnserver/TODO.md | 1 + scnserver/logic/application.go | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/scnserver/TODO.md b/scnserver/TODO.md index 488c9d8..c2d292c 100644 --- a/scnserver/TODO.md +++ b/scnserver/TODO.md @@ -15,6 +15,7 @@ - app-store link in HTML - deploy + - deploy apache conf directly - backups (no longer container in my db_backup, perhaps extend it to sqlite?) diff --git a/scnserver/logic/application.go b/scnserver/logic/application.go index c9618da..53c7a4a 100644 --- a/scnserver/logic/application.go +++ b/scnserver/logic/application.go @@ -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))