http

package
v0.0.0-...-9bd82c6 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Request

func Request(data map[string]string, opts ...Option) (map[string]string, error)

Types

type Callback

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

type Option

type Option func(*Callback)

func WithAfter

func WithAfter(f func(res *hp.Response)) Option

func WithBefore

func WithBefore(f func(req *hp.Request)) Option

type Req

type Req struct {
	URL    string            `map:"url" validate"required"`
	Method string            `map:"method" validate:"required"`
	Proto  string            `map:"ver"`
	Header map[string]string `map:"header"`
	Body   []byte            `map:"body"`
	// contains filtered or unexported fields
}

func NewReq

func NewReq() *Req

func (*Req) Do

func (r *Req) Do() (*Result, error)

type Res

type Res struct {
	Status string            `map:"status"`
	Code   int               `map:"code"`
	Header map[string]string `map:"header"`
	Body   []byte            `map:"body"`
}

type Result

type Result struct {
	Req Req `map:"req"`
	Res Res `map:"res"`
}

type TransportOptions

type TransportOptions struct {
	Timeout      int `map:"timeout"`
	MaxIdleConns int `map:"max_idle_conns"`
}

Jump to

Keyboard shortcuts

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