cohttp

package
v0.0.0-...-deb4dbf Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrScope = "http"

	ErrCodeNetwork = 10
	ErrCodeJson    = 11
)

Variables

This section is empty.

Functions

func IsNetowrkError

func IsNetowrkError(err error) bool

func SetDefaultLogger

func SetDefaultLogger(logger *zap.Logger)

Types

type Client

type Client struct {
	MaxConcurrent int
	RetryTime     int
	RetryInterval time.Duration
	// contains filtered or unexported fields
}

func NewClient

func NewClient(client http.Client, maxConcurrent int,
	retryTime int, retryInterval time.Duration,
	logRespHead int, reporter Reporter) *Client

func (*Client) Do

func (c *Client) Do(req *http.Request) (resp *http.Response, err error)

func (*Client) DoBetter

func (c *Client) DoBetter(req *http.Request) (
	rawdata []byte, hasBody bool, err error)

func (*Client) Json

func (c *Client) Json(req *http.Request, respJson interface{}) error

func (*Client) Text

func (c *Client) Text(req *http.Request) (string, error)

type Reporter

type Reporter interface {
	ConReqNum(int)
}

Jump to

Keyboard shortcuts

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