request

package
v1.9.5 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoRequest

func DoRequest(url string, options ...Option) (code int, respBuf []byte, respHeader map[string][]string, err error)

DoRequest exec https? request and return []byte

func DoRequestUndercourse

func DoRequestUndercourse(url string, options ...Option) (resp *http.Response, err error)

DoRequestUndercourse exec https? request and return response

Types

type Option

type Option func(*Options)

Option request option

func WithContext

func WithContext(ctx context.Context) Option

WithContext set context.

func WithData

func WithData(data []byte) Option

WithData set request data.

func WithHeader

func WithHeader(header map[string]string) Option

WithHeader set request header.

func WithMethod

func WithMethod(method string) Option

WithMethod set request method.

func WithOptions

func WithOptions(options Options) Option

WithOptions accepts the whole options config.

func WithSSL

func WithSSL(ssl bool) Option

WithSSL set request skip ssl verify.

func WithTimeout

func WithTimeout(timeout int) Option

WithTimeout set request timeout.

type Options

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

Options request options

Jump to

Keyboard shortcuts

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