thttp

package
v1.0.0-pre10 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddQuery

func AddQuery(rawUrl string, key string, value string) (string, error)

AddQuery url增加query参数

func Get added in v1.0.1

func Get(u string, headers ...map[string]string) ([]byte, error)

Get 根据path请求资源

func GetToMap added in v1.0.1

func GetToMap(u string, header ...map[string]string) (map[string]interface{}, error)

GetToMap 请求资源,以map形式返回结果

func GetToStruct added in v1.0.1

func GetToStruct[T any](u string, header ...map[string]string) (T, error)

GetToStruct 请求资源,以struct形式返回结果

func PostForm added in v1.0.1

func PostForm(u string, form url.Values, headers ...map[string]string) ([]byte, error)

PostForm 以form格式请求

func PostJSON added in v1.0.1

func PostJSON(u string, jsonByte []byte, headers ...map[string]string) ([]byte, error)

PostJSON 以json格式请求

func PostToMap added in v1.0.1

func PostToMap(u string, jsonByte []byte, header ...map[string]string) (map[string]interface{}, error)

func PostToStruct added in v1.0.1

func PostToStruct[T any](u string, jsonByte []byte, header ...map[string]string) (T, error)

func QueryUrl

func QueryUrl(rawUrl string, key string) (string, error)

QueryUrl 查询url的query参数

func ResponseFail

func ResponseFail[T any](c *gin.Context, httpCode int, code int, msg string, data T)

func ResponseFailDefault

func ResponseFailDefault(c *gin.Context, msg string)

func ResponseSuccess

func ResponseSuccess[T any](c *gin.Context, code int, msg string, data T)

func ResponseSuccessDefault

func ResponseSuccessDefault[T any](c *gin.Context, data T)

Types

This section is empty.

Jump to

Keyboard shortcuts

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