httpUtils

package
v0.0.0-...-eb4b608 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: Unlicense Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HttpClient *http.Client
)

Functions

func GetRequest

func GetRequest(url string, result any) error

func GetRequestWithHeader

func GetRequestWithHeader(url string, headers map[string]string, result any) error

func MultiPartFormRequest

func MultiPartFormRequest(url string, params []MultiPartParam, files []MultiPartFile) (*http.Response, error)

func MultiPartFormRequestWithHeaders

func MultiPartFormRequestWithHeaders(url string, headers map[string]string, params []MultiPartParam, files []MultiPartFile) (*http.Response, error)

func PostRequest

func PostRequest(url string, headers map[string]string, input any, result any) error

Types

type HttpError

type HttpError struct {
	StatusCode int
	Status     string
}

func (*HttpError) Error

func (e *HttpError) Error() string

type MultiPartFile

type MultiPartFile struct {
	FieldName string
	FileName  string
	Content   io.Reader
}

type MultiPartParam

type MultiPartParam struct {
	Name  string
	Value string
}

Jump to

Keyboard shortcuts

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