httpc

package
v1.1.42 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2023 License: MIT Imports: 8 Imported by: 4

Documentation

Index

Constants

View Source
const (
	LogRequest            = 1
	LogResponse           = 2
	NoLogError            = 4
	ErrorLogToInfo        = 8
	NoLogNotAuthorized    = 16
	NoLogPermissionDenied = 32
	NoLogBadStatus        = 64
)

Variables

This section is empty.

Functions

func Object2UrlValues added in v1.0.9

func Object2UrlValues(obj any) url.Values

Types

type BasicAuthCredsSt

type BasicAuthCredsSt struct {
	Username string
	Password string
}

type HttpC

type HttpC interface {
	GetOptions() *OptionsSt
	SetOptions(opts *OptionsSt)
	Send(opts *OptionsSt) (*RespSt, error)
}

type OptionsSt

type OptionsSt struct {
	Client         *http.Client
	Uri            string
	Method         string
	Params         url.Values
	Headers        http.Header
	BasicAuthCreds *BasicAuthCredsSt
	LogFlags       int
	LogPrefix      string
	RetryCount     int
	RetryInterval  time.Duration
	Timeout        time.Duration

	ReqClose     bool
	ReqStream    io.Reader
	ReqBody      []byte
	ReqObj       any
	RepStream    bool
	RepObj       any
	StatusRepObj map[int]any
}

func (*OptionsSt) GetMergedWith

func (o *OptionsSt) GetMergedWith(val *OptionsSt) *OptionsSt

func (*OptionsSt) HasLogFlag added in v1.1.18

func (o *OptionsSt) HasLogFlag(v int) bool

type RespSt added in v1.1.18

type RespSt struct {
	Lg      logger.Lite
	ReqOpts *OptionsSt

	StatusCode        int
	StatusCodeSuccess bool
	Headers           http.Header
	BodyRaw           []byte
	Stream            io.ReadCloser
}

func (*RespSt) LogError added in v1.1.18

func (o *RespSt) LogError(title string, err error, args ...any)

func (*RespSt) LogInfo added in v1.1.18

func (o *RespSt) LogInfo(title string, args ...any)

func (*RespSt) Reset added in v1.1.18

func (o *RespSt) Reset()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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