#2078 - fix BindJSON calls

This commit is contained in:
Carlo Field
2020-05-29 17:44:49 +02:00
parent f8bffd8391
commit 359564bd91
4 changed files with 36 additions and 11 deletions

View File

@@ -15,7 +15,10 @@ func postServerBackup(c *gin.Context) {
s := GetServer(c.Param("server"))
data := &backup.Request{}
c.BindJSON(&data)
// BindJSON sends 400 if the request fails, all we need to do is return
if err := c.BindJSON(&data); err != nil {
return
}
var adapter backup.BackupInterface
var err error
@@ -41,7 +44,6 @@ func postServerBackup(c *gin.Context) {
}
}(adapter, s)
c.Status(http.StatusAccepted)
}