lib

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Fail = func(err error) (gjson.Result, error) { return gjson.Result{}, err }
	GMT8 = time.FixedZone("CST", 8*3600)
)

Functions

func HeaderEncode

func HeaderEncode(h http.Header) string

func HeaderToHttpOption

func HeaderToHttpOption(h http.Header) []curl.Option

func MarshalNoEscapeHTML

func MarshalNoEscapeHTML(v interface{}) ([]byte, error)

MarshalNoEscapeHTML 不带HTML转义的JSON序列化

func Nonce

func Nonce(size uint) string

Nonce 生成指定长度的随机串 (最好是偶数)

func NonceByte

func NonceByte(size uint) []byte

NonceByte 生成指定长度的随机字节

Types

type ReqLog

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

ReqLog 请求日志

func NewReqLog

func NewReqLog(method, reqURL string) *ReqLog

NewReqLog 生成请求日志

func (*ReqLog) Do

func (l *ReqLog) Do(ctx context.Context, log func(ctx context.Context, data map[string]string))

Do 日志记录

func (*ReqLog) Set

func (l *ReqLog) Set(k, v string)

Set 设置日志K-V

func (*ReqLog) SetReqBody

func (l *ReqLog) SetReqBody(v string)

SetBody 设置请求Body

func (*ReqLog) SetReqHeader

func (l *ReqLog) SetReqHeader(h http.Header)

SetReqHeader 设置请求头

func (*ReqLog) SetRespBody

func (l *ReqLog) SetRespBody(v string)

SetResp 设置返回报文

func (*ReqLog) SetRespHeader

func (l *ReqLog) SetRespHeader(h http.Header)

SetRespHeader 设置返回头

func (*ReqLog) SetStatusCode

func (l *ReqLog) SetStatusCode(code int)

SetStatusCode 设置HTTP状态码

type X

type X map[string]any

X 类型别名

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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