httpx

package
v0.0.52 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2026 License: MIT Imports: 24 Imported by: 1

Documentation

Index

Constants

View Source
const (
	AllowMethods = "GET, POST, PUT, DELETE, OPTIONS"
	AllowHeaders = "" +
		"Origin, " +
		"Content-Type, " +
		"Content-Length, " +
		"Accept-Encoding, " +
		"X-CSRF-Token, " +
		"X-Request-ID, " +
		"Authorization, "
)

Variables

This section is empty.

Functions

func CORS

func CORS() gin.HandlerFunc

func DebouceAw

func DebouceAw(path ...string)

func Debounce

func Debounce(duration time.Duration) gin.HandlerFunc

func DebounceDisable

func DebounceDisable()

func DumpRouters

func DumpRouters(call func(info gin.RouteInfo))

func FetchImage added in v0.0.26

func FetchImage(url string) (imgData []byte, contentType, imgType string, error *errors.Error)

FetchImage fetches image from url

func Get

func Get(baseURL string, params map[string]string) (resp string, err *errors.Error)

func GetByCtx

func GetByCtx(ctx *gin.Context, baseURL string, params map[string]interface{}) (map[string]interface{}, *errors.Error)

func GetClientIP deprecated

func GetClientIP(ctx *gin.Context) string

Deprecated: Use apix.GetClientIP() instead.

func GetHeader

func GetHeader(baseURL string, params map[string]string, header map[string]string) (resp string, err *errors.Error)

func GetMap

func GetMap(baseURL string, params map[string]string) (map[string]interface{}, *errors.Error)

func GetMapHeader

func GetMapHeader(baseURL string, params map[string]string, header map[string]string) (map[string]interface{}, *errors.Error)

func GetToken

func GetToken(c *gin.Context) string

func GetTokenByCtx

func GetTokenByCtx(c *gin.Context, mustExit bool) string

GetTokenByCtx

func GetTraceID deprecated

func GetTraceID(ctx *gin.Context) string

Deprecated: Use apix.GetTraceID() instead.

func GetUserID deprecated

func GetUserID(ctx *gin.Context) string

Deprecated: Use apix.GetUserID() instead.

func GetUserIDByToken

func GetUserIDByToken(token string) (userID string)

func GetUserIDInt deprecated

func GetUserIDInt(ctx *gin.Context) int

Deprecated: Use apix.GetUserIDInt() instead.

func GetUserIDInt64 deprecated

func GetUserIDInt64(ctx *gin.Context) int64

Deprecated: Use apix.GetUserIDInt64() instead.

func GetUserInfo deprecated

func GetUserInfo(ctx *gin.Context) map[string]interface{}

Deprecated: Use apix.GetUserInfo() instead.

func GetUserInfoValue deprecated

func GetUserInfoValue(ctx *gin.Context, key string) any

Deprecated: Use apix.GetUserInfoValue() instead.

func IsRegistered added in v0.0.17

func IsRegistered() bool

func Logger

func Logger() gin.HandlerFunc

func NewCtx deprecated

func NewCtx() *gin.Context

Deprecated: Use apix.NewCtx() instead.

func ParseJSON

func ParseJSON(jsonStr string) map[string]interface{}

func ParseXML

func ParseXML[T any](xmlStr string) (*T, *errors.Error)

func PostForm

func PostForm(baseURL string, params map[string]string) (resp string, err *errors.Error)

func PostJSON

func PostJSON(baseURL string, params interface{}) (map[string]interface{}, *errors.Error)

func PostJSONByCtx

func PostJSONByCtx(ctx *gin.Context, baseURL string, params interface{}) (map[string]interface{}, *errors.Error)

func PostJSONHeader

func PostJSONHeader(baseURL string, params interface{}, header map[string]string) (map[string]interface{}, *errors.Error)

func PostJSONResp

func PostJSONResp(baseURL string, params interface{}) (resp string, err *errors.Error)

func PostJSONRespHeader

func PostJSONRespHeader(baseURL string, params interface{}, header map[string]string) (resp string, err *errors.Error)

func PostXML

func PostXML(baseURL string, params map[string]string) (resp string, err *errors.Error)

func Recovery added in v0.0.43

func Recovery() gin.HandlerFunc

func RegisterRouter

func RegisterRouter(reg func(groupRouter *gin.RouterGroup))

RegisterRouter 注册路由

func RegisterRouterMid

func RegisterRouterMid(group func(groupRouter *gin.RouterGroup, mid ...gin.HandlerFunc) *gin.RouterGroup, mid ...gin.HandlerFunc) *gin.RouterGroup

func SetTimeOutTmp added in v0.0.26

func SetTimeOutTmp(t time.Duration)

func SetTraceID deprecated

func SetTraceID(ctx *gin.Context)

Deprecated: Use apix.SetTraceID() instead.

func SetUserID deprecated

func SetUserID(ctx *gin.Context, userID string)

Deprecated: Use apix.SetUserID() instead.

func SetUserInfo deprecated

func SetUserInfo(ctx *gin.Context, userInfo map[string]interface{})

Deprecated: Use apix.SetUserInfo() instead.

func Shutdown

func Shutdown(code string, ctx context.Context) error

func SignDef

func SignDef() gin.HandlerFunc

func SignRedis

func SignRedis() gin.HandlerFunc

func SignUserDef

func SignUserDef(userFilter map[string]interface{}) gin.HandlerFunc

func SignUserRedis

func SignUserRedis(userFilter map[string]interface{}) gin.HandlerFunc

func Startup

func Startup(code, port string) error

Types

type HeaderParams

type HeaderParams struct {
	Authorization string `header:"Authorization" binding:"required,min=20"`
}

type ShardedRequestMap

type ShardedRequestMap struct {
	// contains filtered or unexported fields
}

func NewShardedRequestMap

func NewShardedRequestMap() *ShardedRequestMap

func (*ShardedRequestMap) Get

func (srm *ShardedRequestMap) Get(key string) (time.Time, bool)

func (*ShardedRequestMap) Set

func (srm *ShardedRequestMap) Set(key string, value time.Time)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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