diff options
author | Saumit Dinesan <justsaumit@protonmail.com> | 2023-11-28 22:26:24 +0530 |
---|---|---|
committer | Saumit Dinesan <justsaumit@protonmail.com> | 2023-11-28 22:26:24 +0530 |
commit | 3f997bbfdc53ad68a025e65831197197727a3ce3 (patch) | |
tree | 9eb1d3556a88f89fc1b2e9c1d284ee1233e29802 /handlers/handlers.go | |
parent | f2a259d332f744abd8b92c45765c85de3fa10753 (diff) |
verification response as int
Diffstat (limited to 'handlers/handlers.go')
-rw-r--r-- | handlers/handlers.go | 6 |
1 files changed, 3 insertions, 3 deletions
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"}) } |