Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
shuitai committed Dec 9, 2020
1 parent 8e58069 commit 9890935
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions restx/httpx/response.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package httpx

import (
"github.com/gofiber/fiber/v2"
"github.com/shuitai/coney-framework/core/logx"
"net/http"
)

func Error(c *fiber.Ctx, code int, err error) {
c.Status(code)
logx.Error(err.Error())
}

func ErrorCode(c *fiber.Ctx, code int) {
c.Status(code)
}

func ErrorJson(c *fiber.Ctx, code int, v interface{}, err error) {
c.Status(code)
c.JSON(v)
logx.Error(err.Error())
}

func Ok(c *fiber.Ctx) {
c.Status(http.StatusOK)
}

func OkJson(c *fiber.Ctx, v interface{}) {
c.Status(http.StatusOK)
c.JSON(v)
}

0 comments on commit 9890935

Please sign in to comment.