http_requests

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteAndParse

func DeleteAndParse[T any](client *http.Client, url string, options ...HttpOptions) (*T, error)

func GetAndParse

func GetAndParse[T any](client *http.Client, url string, options ...HttpOptions) (*T, error)

func GetAndParseStream

func GetAndParseStream[T any](client *http.Client, url string, options ...HttpOptions) (*stream.Stream[T], error)

func PatchAndParse

func PatchAndParse[T any](client *http.Client, url string, options ...HttpOptions) (*T, error)

func PostAndParse

func PostAndParse[T any](client *http.Client, url string, options ...HttpOptions) (*T, error)

func PostAndParseStream

func PostAndParseStream[T any](client *http.Client, url string, options ...HttpOptions) (*stream.Stream[T], error)

func PutAndParse

func PutAndParse[T any](client *http.Client, url string, options ...HttpOptions) (*T, error)

func PutAndParseStream

func PutAndParseStream[T any](client *http.Client, url string, options ...HttpOptions) (*stream.Stream[T], error)

func Request

func Request(client *http.Client, url string, method string, options ...HttpOptions) (*http.Response, error)

func RequestAndParse

func RequestAndParse[T any](client *http.Client, url string, method string, options ...HttpOptions) (*T, error)

func RequestAndParseStream

func RequestAndParseStream[T any](client *http.Client, url string, method string, options ...HttpOptions) (*stream.Stream[T], error)

Types

type HttpOptions

type HttpOptions struct {
	Type  string
	Value interface{}
}

func HttpHeader

func HttpHeader(header map[string]string) HttpOptions

func HttpParams

func HttpParams(params map[string]string) HttpOptions

which is used for params with in url

func HttpPayload

func HttpPayload(payload map[string]string) HttpOptions

which is used for POST method only

func HttpPayloadJson

func HttpPayloadJson(payload interface{}) HttpOptions

which is used for POST method only

func HttpPayloadMultipart

func HttpPayloadMultipart(payload map[string]string, files map[string]HttpPayloadMultipartFile) HttpOptions

which is used for POST method only payload follows the form data format, and files is a map from filename to file

func HttpPayloadText

func HttpPayloadText(payload string) HttpOptions

which is used for POST method only

func HttpRaiseErrorWhenStreamDataNotMatch

func HttpRaiseErrorWhenStreamDataNotMatch(raise bool) HttpOptions

func HttpReadTimeout

func HttpReadTimeout(timeout int64) HttpOptions

milliseconds

func HttpWithDirectReferer

func HttpWithDirectReferer() HttpOptions

func HttpWithRetCode

func HttpWithRetCode(retCode *int) HttpOptions

func HttpWriteTimeout

func HttpWriteTimeout(timeout int64) HttpOptions

milliseconds

type HttpPayloadMultipartFile

type HttpPayloadMultipartFile struct {
	Filename string
	Reader   io.Reader
}

Jump to

Keyboard shortcuts

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