mirror of
https://github.com/bettercap/bettercap
synced 2025-07-06 13:02:12 -07:00
balls
This commit is contained in:
parent
fd18dffd1a
commit
d14bd6fc1c
1 changed files with 6 additions and 6 deletions
|
@ -15,7 +15,7 @@ type CommandRequest struct {
|
|||
Command string `json:"cmd"`
|
||||
}
|
||||
|
||||
type ApiResponse struct {
|
||||
type APIResponse struct {
|
||||
Success bool `json:"success"`
|
||||
Message string `json:"msg"`
|
||||
}
|
||||
|
@ -35,12 +35,12 @@ func SafeBind(c *gin.Context, obj interface{}) error {
|
|||
return binding.Validator.ValidateStruct(obj)
|
||||
}
|
||||
|
||||
func BadRequest(c *gin.Context, opt_msg ...string) {
|
||||
func BadRequest(c *gin.Context, optMsg ...string) {
|
||||
msg := "Bad Request"
|
||||
if len(opt_msg) > 0 {
|
||||
msg = opt_msg[0]
|
||||
if len(optMsg) > 0 {
|
||||
msg = optMsg[0]
|
||||
}
|
||||
c.JSON(400, ApiResponse{
|
||||
c.JSON(400, APIResponse{
|
||||
Success: false,
|
||||
Message: msg,
|
||||
})
|
||||
|
@ -63,7 +63,7 @@ func RunRestCommand(c *gin.Context) {
|
|||
if err != nil {
|
||||
BadRequest(c, err.Error())
|
||||
} else {
|
||||
c.JSON(200, ApiResponse{Success: true})
|
||||
c.JSON(200, APIResponse{Success: true})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue