http

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: May 3, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Debug     bool                   // 是否开启debug模式
	Url       string                 // 请求地址
	Params    map[string]string      // 请求参数
	Header    map[string]string      // 请求头
	Form      map[string]interface{} // 表单参数
	UserAgent string                 // User-Agent
}

func (*Client) Get

func (Client *Client) Get() ([]byte, error)

Get get请求返回[]byte

func (*Client) Post

func (Client *Client) Post() ([]byte, error)

Post post请求返回[]byte

type GinHandle added in v0.0.4

type GinHandle struct{}

func (*GinHandle) DefaultQuery added in v0.0.4

func (*GinHandle) DefaultQuery(c *gin.Context, key string, defaultValue string) string

DefaultQuery 获取get参数,如果没有则返回默认值

func (*GinHandle) FormFile added in v0.0.9

func (*GinHandle) FormFile(c *gin.Context, key string) (*multipart.FileHeader, error)

FormFile 获取上传文件

func (*GinHandle) Param added in v0.0.4

func (*GinHandle) Param(c *gin.Context, key string) string

Param 获取路由参数

func (*GinHandle) Query added in v0.0.4

func (*GinHandle) Query(c *gin.Context, key string) string

Query 获取get参数

func (*GinHandle) RetuenOk added in v0.0.5

func (*GinHandle) RetuenOk(c *gin.Context, data interface{})

RetuenOk 返回成功json

func (*GinHandle) ReturnErr added in v0.0.5

func (*GinHandle) ReturnErr(c *gin.Context, r respx.Pt)

ReturnErr 返回错误json

func (*GinHandle) ReturnJSON added in v0.0.5

func (*GinHandle) ReturnJSON(c *gin.Context, code int, data interface{})

ReturnJSON 返回json

func (*GinHandle) ShouldBind added in v0.0.4

func (*GinHandle) ShouldBind(c *gin.Context, s interface{}) error

ShouldBind Get绑定到结构体

func (*GinHandle) ShouldBindJSON added in v0.0.4

func (*GinHandle) ShouldBindJSON(c *gin.Context, s interface{}) error

ShouldBindJSON Post绑定到结构体

Jump to

Keyboard shortcuts

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