From fefb37481c01f7fe5961ee9bdf683b0dfa109d84 Mon Sep 17 00:00:00 2001 From: Emmanuel Gautier Date: Tue, 5 Mar 2024 19:41:12 +0100 Subject: [PATCH] fix: http body closed prevented to bind file endpoint content --- api/files.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/api/files.go b/api/files.go index 7e7cc61..f23e1e9 100644 --- a/api/files.go +++ b/api/files.go @@ -74,14 +74,14 @@ func (h *Handler) CreateFile(ctx *gin.Context) { return } - var form FileContentForm - if err := ctx.ShouldBindJSON(&form); err != nil { + var queryForm RefForm + if err := ctx.ShouldBindQuery(&queryForm); err != nil { RespondError(ctx, http.StatusBadRequest, HTTPRequestValidationFailed, err) return } - var queryForm RefForm - if err := ctx.ShouldBindQuery(&queryForm); err != nil { + var form FileContentForm + if err := ctx.ShouldBind(&form); err != nil { RespondError(ctx, http.StatusBadRequest, HTTPRequestValidationFailed, err) return } @@ -124,14 +124,14 @@ func (h *Handler) UpdateFile(ctx *gin.Context) { return } - var form FileContentForm - if err := ctx.ShouldBindJSON(&form); err != nil { + var queryForm RefForm + if err := ctx.ShouldBindQuery(&queryForm); err != nil { RespondError(ctx, http.StatusBadRequest, HTTPRequestValidationFailed, err) return } - var queryForm RefForm - if err := ctx.ShouldBindQuery(&queryForm); err != nil { + var form FileContentForm + if err := ctx.ShouldBind(&form); err != nil { RespondError(ctx, http.StatusBadRequest, HTTPRequestValidationFailed, err) return }