Skip to content

Commit

Permalink
Merge pull request #35 from thegalactiks/fix-post-file
Browse files Browse the repository at this point in the history
fix: http body closed prevented to bind file endpoint content
  • Loading branch information
emmanuelgautier authored Mar 5, 2024
2 parents e13bdf4 + fefb374 commit 9f5e926
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions api/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 9f5e926

Please sign in to comment.