flaghttp

package
v3.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: BSD-3-Clause Imports: 10 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 interface {
	NewRequest() Request
	R() Request
	SetHeader(header, value string) Client
	SetHeaders(headers map[string]string) Client
	SetLogger(l Logger) Client
	SetProxy(proxyURL string) Client
	SetRetryCount(count int) Client
	SetRetryWaitTime(waitTime time.Duration) Client
	SetTimeout(timeout time.Duration) Client
}

func NewClient

func NewClient() Client

type Logger

type Logger interface {
	Errorf(format string, v ...any)
	Warnf(format string, v ...any)
	Debugf(format string, v ...any)
}

type Request

type Request interface {
	ForceContentType(contentType string) Request
	Get(url string) (Response, error)
	Post(url string) (Response, error)
	SetBody(body any) Request
	SetContext(ctx context.Context) Request
	SetResult(res any) Request
	SetError(err any) Request
}

type Response

type Response interface {
	Body() []byte
	IsSuccess() bool
	Status() string
	StatusCode() int
}

Jump to

Keyboard shortcuts

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