Added codes in API responses

This commit is contained in:
Florian Sylvain
2023-01-18 21:00:32 +01:00
parent 245ddbc137
commit c681b5389c
+3 -3
View File
@@ -7,13 +7,13 @@ import (
) )
func SendBadRequest(c *gin.Context, message string) { func SendBadRequest(c *gin.Context, message string) {
c.JSON(http.StatusBadRequest, gin.H{"message": message}) c.JSON(http.StatusBadRequest, gin.H{"message": message, "code": 400})
} }
func SendOk(c *gin.Context, message string) { func SendOk(c *gin.Context, message string) {
c.JSON(http.StatusOK, gin.H{"message": message}) c.JSON(http.StatusOK, gin.H{"message": message, "code": 200})
} }
func SendForbidden(c *gin.Context, message string) { func SendForbidden(c *gin.Context, message string) {
c.JSON(http.StatusForbidden, gin.H{"message": message}) c.JSON(http.StatusForbidden, gin.H{"message": message, "code": 403})
} }