Skip to content

Commit

Permalink
fix: http body closed prevented to bind file endpoint content
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelgautier committed Mar 5, 2024
1 parent e13bdf4 commit fefb374
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 fefb374

Please sign in to comment.