http

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2025 License: Apache-2.0 Imports: 10 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package http contains utilities for making HTTP requests.

Index

Constants

View Source
const (
	HeaderAccept          = "Accept"
	HeaderUserAgent       = "User-Agent"
	HeaderAuthorization   = "Authorization"
	HeaderContentEncoding = "Content-Encoding"
	HeaderContentType     = "Content-Type"
	HeaderAcceptEncoding  = "Accept-Encoding"
)
View Source
const (
	ContentTypeGzip      = "gzip"
	ContentTypeProtobuf  = "application/x-protobuf"
	ContentTypeJSON      = "application/json"
	ContentTypeValueBin  = "application/octet-stream"
	ContentTypeValueTxt  = "text/plain"
	ContentTypeValueYAML = "text/yaml"
	ContentTypeValueCSV  = "text/csv"
)
View Source
const (
	QueryParamClusterName = "cluster_name"
	QueryParamAccountID   = "cloud_account_id"
	QueryParamRegion      = "region"
)

Variables

View Source
var (
	ErrStatusBadRequest                    = errors.New("badrequest error")
	ErrStatusUnauthorized                  = errors.New("unauthorized error")
	ErrStatusPaymentRequired               = errors.New("paymentrequired error")
	ErrStatusForbidden                     = errors.New("forbidden error")
	ErrStatusNotFound                      = errors.New("not found error")
	ErrStatusMethodNotAllowed              = errors.New("method not allowed error")
	ErrStatusNotAcceptable                 = errors.New("not acceptable error")
	ErrStatusProxyAuthRequired             = errors.New("proxy authrequired error")
	ErrStatusRequestTimeout                = errors.New("request timeout error")
	ErrStatusConflict                      = errors.New("conflict error")
	ErrStatusGone                          = errors.New("gone error")
	ErrStatusLengthRequired                = errors.New("length required error")
	ErrStatusPreconditionFailed            = errors.New("precondition failed error")
	ErrStatusRequestEntityTooLarge         = errors.New("requestentity too large error")
	ErrStatusRequestURITooLong             = errors.New("request uri too long error")
	ErrStatusUnsupportedMediaType          = errors.New("unsupported media type error")
	ErrStatusRequestedRangeNotSatisfiable  = errors.New("requested range not satisfiable error")
	ErrStatusExpectationFailed             = errors.New("expectation failed error")
	ErrStatusTeapot                        = errors.New("teapot error")
	ErrStatusMisdirectedRequest            = errors.New("misdirected request error")
	ErrStatusUnprocessableEntity           = errors.New("unprocessable entity error")
	ErrStatusLocked                        = errors.New("locked error")
	ErrStatusFailedDependency              = errors.New("failed dependency error")
	ErrStatusTooEarly                      = errors.New("too early error")
	ErrStatusUpgradeRequired               = errors.New("upgrade required error")
	ErrStatusPreconditionRequired          = errors.New("precondition required error")
	ErrStatusTooManyRequests               = errors.New("too many requests error")
	ErrStatusRequestHeaderFieldsTooLarge   = errors.New("request header fields too large error")
	ErrStatusInternalServerError           = errors.New("internal server error")
	ErrStatusNotImplemented                = errors.New("not implemented error")
	ErrStatusBadGateway                    = errors.New("bad gateway error")
	ErrStatusServiceUnavailable            = errors.New("service unavailable error")
	ErrStatusGatewayTimeout                = errors.New("gateway timeout error")
	ErrStatusHTTPVersionNotSupported       = errors.New("http version not supported error")
	ErrStatusVariantAlsoNegotiates         = errors.New("variant also negotiates error")
	ErrStatusInsufficientStorage           = errors.New("insufficient storage error")
	ErrStatusLoopDetected                  = errors.New("loop detected error")
	ErrStatusNotExtended                   = errors.New("not extended error")
	ErrStatusNetworkAuthenticationRequired = errors.New("network authentication required error")
)

Functions

func Do

func Do(
	ctx context.Context,
	client *http.Client,
	method string,
	headers map[string]string,
	queryParams map[string]string,
	uri string,
	body io.Reader,
) (int, error)

func ToError

func ToError(code int) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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