gokhttp_requests

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: MIT Imports: 9 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecuteOpts

func ExecuteOpts(req *http.Request, opts ...Option) error

func MakeGETRequest

func MakeGETRequest(ctx context.Context, httpURL string, opts ...Option) (*http.Request, error)

MakeGETRequest Makes a GET request

func MakeHEADRequest

func MakeHEADRequest(ctx context.Context, httpURL string, opts ...Option) (*http.Request, error)

MakeHEADRequest Makes a HEAD request

func MakePOSTRequest

func MakePOSTRequest(ctx context.Context, httpURL string, opts ...Option) (*http.Request, error)

MakePOSTRequest Makes a POST request

Types

type HeaderOption

type HeaderOption struct {
	Headers http.Header
	Replace bool
}

func NewHeaderOption

func NewHeaderOption(headers http.Header) *HeaderOption

func NewHeaderOptionFromMap

func NewHeaderOptionFromMap(headers map[string]string) *HeaderOption

func (*HeaderOption) Execute

func (o *HeaderOption) Execute(req *http.Request) error

type Option

type Option interface {
	Execute(r *http.Request) error
}

type POSTRawOption

type POSTRawOption struct {
	Body          io.ReadCloser
	ContentLength int64
	ContentType   string
}

func NewPOSTFormOption

func NewPOSTFormOption(values url.Values) *POSTRawOption

func NewPOSTFormOptionFromMap

func NewPOSTFormOptionFromMap(values map[string]string) *POSTRawOption

func NewPOSTJSONOption added in v0.2.6

func NewPOSTJSONOption(data []byte, isUTF8 bool) *POSTRawOption

func NewPOSTJSONOptionFromReader added in v0.2.6

func NewPOSTJSONOptionFromReader(data io.Reader, length int, isUTF8 bool) *POSTRawOption

func NewPOSTMultipartOption

func NewPOSTMultipartOption(writer *gokhttp_multipart.Wrapper) *POSTRawOption

func NewPOSTRawOption

func NewPOSTRawOption(data io.Reader, contentType string, contentLength int64) *POSTRawOption

func (*POSTRawOption) Execute

func (o *POSTRawOption) Execute(req *http.Request) error

type RawURLParamOption

type RawURLParamOption struct {
	RawQuery string
}

func NewRawURLParamOption

func NewRawURLParamOption(rawQuery string) *RawURLParamOption

func (*RawURLParamOption) Execute

func (o *RawURLParamOption) Execute(req *http.Request) error

type URLParamOption

type URLParamOption struct {
	Values url.Values
}

func NewURLParamOption

func NewURLParamOption(values url.Values) *URLParamOption

func NewURLParamOptionFromMap

func NewURLParamOptionFromMap(values map[string]string) *URLParamOption

func (*URLParamOption) Execute

func (o *URLParamOption) Execute(req *http.Request) error

Jump to

Keyboard shortcuts

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