httputil

package
v0.0.0-...-a1b4a84 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 7, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusOK = 0

	StatusBad = 100 + iota
	StatusBadRequest
	StatusInternalServerError

	Proxy = 200 + iota
	ProxyNotAllowed
	ProxyNotFound

	ProxyBadRequest          // 请求参数错误
	ProxyInternalServerError // 函数内存错误,通常为非超时造成的错误
	ProxyTimeout             // 超时错误
)
View Source
const (
	ErrBadRequestParams = "解析请求数据失败"
)

Variables

This section is empty.

Functions

func BadGateway

func BadGateway(ctx *gin.Context)

func BadGatewayWithJSON

func BadGatewayWithJSON(ctx *gin.Context, data any)

func BadRequest

func BadRequest(ctx *gin.Context)

func BadRequestWithJSON

func BadRequestWithJSON(ctx *gin.Context, data any)

func InternalError

func InternalError(ctx *gin.Context)

func InternalErrorWithJSON

func InternalErrorWithJSON(ctx *gin.Context, data any)

func JSON

func JSON(ctx *gin.Context, statusCode int, reply any)

func OK

func OK(ctx *gin.Context)

func OKWithJSON

func OKWithJSON(ctx *gin.Context, reply any)

func Timeout

func Timeout(ctx *gin.Context)

func TimeoutWithJSON

func TimeoutWithJSON(ctx *gin.Context, data any)

Types

type Response

type Response struct {
	Code    int    `json:"status"`
	Message string `json:"message"`
	Data    any    `json:"data"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL