Skip to content

Commit

Permalink
Merge pull request #2259 from z10mx7/master
Browse files Browse the repository at this point in the history
Fix: Return Correct Status Code for Successful Update
  • Loading branch information
ReneWerner87 authored Jun 26, 2024
2 parents aa602c6 + 477b6a3 commit 12775dd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gorm-mysql/routes/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func Update(c *fiber.Ctx) error {

database.DBConn.Model(&models.Book{}).Where("id = ?", id).Update("title", book.Title)

return c.Status(400).JSON("updated")
return c.Status(200).JSON("updated")
}

//Delete
Expand Down
2 changes: 1 addition & 1 deletion gorm-postgres/routes/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func Update(c *fiber.Ctx) error {

database.DB.Db.Model(&book).Where("title = ?", title.Title).Update("author", title.Author)

return c.Status(400).JSON("updated")
return c.Status(200).JSON("updated")
}

// Delete
Expand Down

0 comments on commit 12775dd

Please sign in to comment.