httpx

package
v0.7.14 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: MIT Imports: 12 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddParamsToURL added in v0.7.8

func AddParamsToURL(originURL string, params *url.Values) (*url.URL, error)

AddParamsToURL ...

func BuildURLWithQueryParams added in v0.7.10

func BuildURLWithQueryParams(baseURL string, params map[string]string) (string, error)

BuildURLWithQueryParams ...

func Download added in v0.7.7

func Download(fileURL string, params *url.Values, headers map[string]string, filepath string, timeout ...time.Duration) (int64, error)

Download ...

func DownloadHander added in v0.5.22

func DownloadHander(resp http.ResponseWriter, reader io.Reader, filename string) error

func DownloadHandler added in v0.7.7

func DownloadHandler(resp http.ResponseWriter, reader io.Reader, filename string) error

func Get

func Get(schemaHostPath string, params *url.Values, headers map[string]string, dst interface{}, timeout ...time.Duration) ([]byte, error)

Get Send a get request

func HandleResp

func HandleResp(resp *http.Response, dst interface{}) ([]byte, error)

HandleResp check http status code and unmarshal a response body

func NewFormBody

func NewFormBody(params map[string]string, files []*FileInfo) (contentType string, body io.Reader, err error)

NewFormBody represent create a http form data request Parameters

params: represent fields
files: represent update files

func Post added in v0.5.9

func Post(schemaHostPath string, headers map[string]string, body io.Reader, dst interface{}, timeout ...time.Duration) ([]byte, error)

Post Send a post request

func WrapHTTPProxy

func WrapHTTPProxy(client *http.Client, proxyURL string, insecure bool) (*http.Client, error)

WrapHTTPProxy add a proxy for a http client

Types

type FileInfo

type FileInfo struct {
	Fieldname string
	Filename  string
	Data      io.Reader
}

FileInfo for update file info

Jump to

Keyboard shortcuts

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