Make requests with optional body work without body

Signed-off-by: mkljczk <git@mkljczk.pl>
This commit is contained in:
mkljczk 2025-03-01 22:15:25 +01:00
commit 630ea8ec54
2 changed files with 10 additions and 6 deletions

View file

@ -112,9 +112,11 @@ func (m *Module) AccountMutePOSTHandler(c *gin.Context) {
}
form := &apimodel.UserMuteCreateUpdateRequest{}
if err := c.ShouldBind(form); err != nil {
apiutil.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGetV1)
return
if c.Request.ContentLength > 0 {
if err := c.ShouldBind(form); err != nil {
apiutil.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGetV1)
return
}
}
if err := normalizeCreateUpdateMute(form); err != nil {