http_request

package
v2.1.41 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrIncorrectCode = errors.New("incorrect http status")

ErrIncorrectCode 非2xx 状态码

Functions

func MustCode200 added in v2.1.18

func MustCode200(cli *resty.Client, resp *resty.Response) error

MustCode200 将非200的状态码认为错误的(注意:设置 SetDoNotParseResponse 后不会触发任何middware包括这个)

Types

type AliyunLog added in v2.0.10

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

func NewAliyunLog added in v2.0.10

func NewAliyunLog(topic string) *AliyunLog

func (*AliyunLog) ErrorV added in v2.1.18

func (l *AliyunLog) ErrorV(ctx context.Context, keyvals ...interface{}) error

func (*AliyunLog) InfoV added in v2.1.18

func (l *AliyunLog) InfoV(ctx context.Context, keyvals ...interface{}) error

func (*AliyunLog) WarnV added in v2.1.18

func (l *AliyunLog) WarnV(ctx context.Context, keyvals ...interface{}) error

type GocoreLog added in v2.0.10

type GocoreLog struct {
}

func NewGocoreLog added in v2.0.10

func NewGocoreLog() *GocoreLog

func (*GocoreLog) ErrorV added in v2.1.18

func (l *GocoreLog) ErrorV(ctx context.Context, keyvals ...interface{}) error

func (*GocoreLog) InfoV added in v2.1.18

func (l *GocoreLog) InfoV(ctx context.Context, keyvals ...interface{}) error

func (*GocoreLog) WarnV added in v2.1.18

func (l *GocoreLog) WarnV(ctx context.Context, keyvals ...interface{}) error

type HttpClient

type HttpClient struct {
	Client  *resty.Client
	Request *resty.Request
	// contains filtered or unexported fields
}

func New

func New() *HttpClient

func (*HttpClient) SetDisableBreaker added in v2.1.18

func (h *HttpClient) SetDisableBreaker(disable bool) *HttpClient

func (*HttpClient) SetDisableLog added in v2.1.18

func (h *HttpClient) SetDisableLog(disable bool) *HttpClient

func (*HttpClient) SetDisableMetrics added in v2.1.18

func (h *HttpClient) SetDisableMetrics(disable bool) *HttpClient

func (*HttpClient) SetLog added in v2.0.10

func (h *HttpClient) SetLog(log Log) *HttpClient

func (*HttpClient) SetMaxShowBodySize added in v2.1.40

func (h *HttpClient) SetMaxShowBodySize(bodySize int64) *HttpClient

func (*HttpClient) SetReqBodyLogsWithPath added in v2.1.20

func (h *HttpClient) SetReqBodyLogsWithPath(paths []string) *HttpClient

func (*HttpClient) SetRespBodyLogsWithPath added in v2.1.20

func (h *HttpClient) SetRespBodyLogsWithPath(paths []string) *HttpClient

func (*HttpClient) SetSlowThresholdMs added in v2.1.20

func (h *HttpClient) SetSlowThresholdMs(threshold int64) *HttpClient

func (*HttpClient) SetTrace

func (h *HttpClient) SetTrace(header interface{}) *HttpClient

type Log added in v2.0.10

type Log interface {
	InfoV(ctx context.Context, keyvals ...interface{}) error
	WarnV(ctx context.Context, keyvals ...interface{}) error
	ErrorV(ctx context.Context, keyvals ...interface{}) error
}

Jump to

Keyboard shortcuts

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