requests

package module
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2024 License: MIT Imports: 19 Imported by: 0

README

requests

Go requests library.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyBody = errors.New("empty body")

Functions

func MarshalHeaders

func MarshalHeaders(v any) (data http.Header, err error)

func MarshalJson

func MarshalJson(v any) (str string, err error)

func MarshalQuery

func MarshalQuery(v any) (s string, err error)

func UnmarshalHeaders

func UnmarshalHeaders(data http.Header, v any) (err error)

Types

type Builder

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

func (*Builder) Body

func (rb *Builder) Body(body []byte) *Builder

func (*Builder) BodyForm

func (rb *Builder) BodyForm(object any) *Builder

func (*Builder) BodyJson

func (rb *Builder) BodyJson(object any) *Builder

func (*Builder) BodyReader

func (rb *Builder) BodyReader(reader io.Reader) *Builder

func (*Builder) Build

func (rb *Builder) Build() *Request

func (*Builder) BuildURL

func (rb *Builder) BuildURL() (u *url.URL)

func (*Builder) Header

func (rb *Builder) Header(object any) *Builder

func (*Builder) HeaderAdd

func (rb *Builder) HeaderAdd(key string, value string) *Builder

func (*Builder) HeaderUpdate added in v1.0.2

func (rb *Builder) HeaderUpdate(header http.Header) *Builder

func (*Builder) Host

func (rb *Builder) Host(host string) *Builder

func (*Builder) Method

func (rb *Builder) Method(method string) *Builder

func (*Builder) Path

func (rb *Builder) Path(path string) *Builder

func (*Builder) Query

func (rb *Builder) Query(object any) *Builder

func (*Builder) QueryString

func (rb *Builder) QueryString(query string) *Builder

func (*Builder) Scheme

func (rb *Builder) Scheme(scheme string) *Builder

func (*Builder) Url

func (rb *Builder) Url(us string) *Builder

type Conn added in v1.1.0

type Conn interface {
	RoundTrip(r *http.Request) (resp *http.Response, err error)
}

func NewConn added in v1.1.0

func NewConn(config ...ConnConfig) Conn

type ConnConfig added in v1.1.0

type ConnConfig struct {
	Proxy     string
	DisableH2 bool
	EnableH3  bool
}

type Request added in v1.0.1

type Request struct {
	R *http.Request
	// contains filtered or unexported fields
}

func (*Request) Send added in v1.0.1

func (req *Request) Send() (resp *http.Response, err error)

func (*Request) WantBody added in v1.0.1

func (req *Request) WantBody() (body []byte, err error)

func (*Request) WantJson added in v1.0.1

func (req *Request) WantJson(v any) error

func (*Request) WithContext added in v1.0.6

func (req *Request) WithContext(ctx context.Context) *Request

func (*Request) WithHost added in v1.0.6

func (req *Request) WithHost(host string) *Request

func (*Request) WithProxyTransport added in v1.0.6

func (req *Request) WithProxyTransport(us string) *Request

func (*Request) WithTransport added in v1.0.6

func (req *Request) WithTransport(transport http.RoundTripper) *Request

type Status

type Status struct {
	Code     int    `json:"status"`
	Message  string `json:"message"`
	Location string `json:"location"`
}

func (*Status) Error

func (e *Status) Error() string

Directories

Path Synopsis
internal
httpheader
Package httpheader implements encoding of structs into http.Header fields.
Package httpheader implements encoding of structs into http.Header fields.
query
Package query implements encoding of structs into URL query parameters.
Package query implements encoding of structs into URL query parameters.

Jump to

Keyboard shortcuts

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