httpclient

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2022 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const EnvNameHttpPrefix = "EPCC_CLI_HTTP_HEADER_"

Variables

View Source
var HttpClient = &http.Client{
	Timeout: time.Second * 10,
}
View Source
var Limit *rate.Limiter = nil
View Source
var UserAgent = fmt.Sprintf("epcc-cli/%s-%s (%s/%s)", version.Version, version.Commit, runtime.GOOS, runtime.GOARCH)

Functions

func AddHeaderByFlag

func AddHeaderByFlag(r *http.Request) error

func DoFileRequest

func DoFileRequest(ctx context.Context, path string, payload io.Reader, contentType string) (response *http.Response, error error)

func DoRequest

func DoRequest(ctx context.Context, method string, path string, query string, payload io.Reader) (response *http.Response, error error)

func EncodeForm

func EncodeForm(values map[string]string, filename string, paramName string, fileContents []byte) (byteBuf *bytes.Buffer, contentType string, err error)

https://stackoverflow.com/questions/20205796/post-data-using-the-content-type-multipart-form-data

func LogStats added in v0.7.0

func LogStats()

Types

This section is empty.

Jump to

Keyboard shortcuts

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