#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

@@ -77,7 +77,10 @@ func postUpdateConfiguration(c *gin.Context) {
// A copy of the configuration we're using to bind the data recevied into.
cfg := *config.Get()
c.BindJSON(&cfg)
// BindJSON sends 400 if the request fails, all we need to do is return
if err := c.BindJSON(&cfg); err != nil {
return
}
config.Set(&cfg)
if err := config.Get().WriteToDisk(); err != nil {
@@ -90,4 +93,4 @@ func postUpdateConfiguration(c *gin.Context) {
}
c.Status(http.StatusNoContent)
}
}