mirror of
https://github.com/Floriansylvain/RenewCMS.git
synced 2026-08-19 19:53:21 +02:00
Added codes in API responses
This commit is contained in:
@@ -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})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user