From 3f997bbfdc53ad68a025e65831197197727a3ce3 Mon Sep 17 00:00:00 2001 From: Saumit Dinesan Date: Tue, 28 Nov 2023 22:26:24 +0530 Subject: verification response as int --- handlers/handlers.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'handlers/handlers.go') diff --git a/handlers/handlers.go b/handlers/handlers.go index 037d6df..62b9ac0 100644 --- a/handlers/handlers.go +++ b/handlers/handlers.go @@ -107,7 +107,7 @@ func VerifyHash(c echo.Context) error { err = db.QueryRow("SELECT HashValue FROM hashes WHERE ID = ?", id).Scan(&storedHash) if err != nil { if err == sql.ErrNoRows { - return c.JSON(http.StatusNotFound, map[string]string{"message": "ID not found"}) + return c.JSON(http.StatusNotFound, map[string]string{"message": "2"}) } log.Println("Failed to query database:", err) return c.JSON(http.StatusInternalServerError, map[string]string{"message": "Failed to retrieve stored hash"}) @@ -116,8 +116,8 @@ func VerifyHash(c echo.Context) error { // Compare the generated hash with the stored hash if hash != storedHash { log.Println("Hash verification failed") - return c.JSON(http.StatusUnauthorized, map[string]string{"message": "Hash verification failed"}) + return c.JSON(http.StatusUnauthorized, map[string]string{"message": "1"}) } log.Println("Hash verified successfully") - return c.JSON(http.StatusOK, map[string]string{"message": "Hash verified successfully"}) + return c.JSON(http.StatusOK, map[string]string{"message": "0"}) } -- cgit v1.2.3