From a1fd8ea8257a192e3aa3c312f643e7ff6b927281 Mon Sep 17 00:00:00 2001 From: chopster44 Date: Sun, 16 Jul 2023 17:33:51 +0100 Subject: [PATCH] Updated error response --- main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 553b07a..923f4ff 100644 --- a/main.go +++ b/main.go @@ -46,6 +46,7 @@ func login(c *gin.Context) { // get the username and password from the request var userData loginInput if err := c.BindJSON(&userData); err != nil { + c.IndentedJSON(http.StatusNotAcceptable, userData) return } // check for user using given credentials @@ -61,7 +62,7 @@ func login(c *gin.Context) { } if user.Password != userData.Password { // user not real - c.IndentedJSON(http.StatusMethodNotAllowed, userData) + c.IndentedJSON(http.StatusNotAcceptable, userData) return } else { // user is in