Documentation ¶
Index ¶
- Variables
- func Delete(url string, options ...SendOption) (*http.Response, error)
- func Get(url string, options ...SendOption) (*http.Response, error)
- func Head(url string, options ...SendOption) (*http.Response, error)
- func IsAccepted(err error) bool
- func IsConflict(err error) bool
- func IsCreated(err error) bool
- func IsForbidden(err error) bool
- func IsNetworkError(err error) bool
- func IsNotFound(err error) bool
- func IsRetryable(err error) bool
- func IsStatus(err error, status int) bool
- func Patch(url string, options ...SendOption) (*http.Response, error)
- func Post(url string, options ...SendOption) (*http.Response, error)
- func Put(url string, options ...SendOption) (*http.Response, error)
- func Send(method, rawurl string, options ...SendOption) (*http.Response, error)
- type NetworkError
- type RetryOption
- type Secret
- type SendOption
- func DisableHTTPFallback() SendOption
- func SendAcceptedCodes(codes ...int) SendOption
- func SendBody(body io.Reader) SendOption
- func SendClient(client *http.Client) SendOption
- func SendContext(ctx context.Context) SendOption
- func SendHeaders(headers map[string]string) SendOption
- func SendNoop() SendOption
- func SendRedirect(redirect func(req *http.Request, via []*http.Request) error) SendOption
- func SendRetry(options ...RetryOption) SendOption
- func SendTLS(config *tls.Config) SendOption
- func SendTLSTransport(transport http.RoundTripper) SendOption
- func SendTimeout(timeout time.Duration) SendOption
- func SendTransport(transport http.RoundTripper) SendOption
- type StatusError
- type TLSConfig
- type X509Pair
Constants ¶
This section is empty.
Variables ¶
var ErrEmptyCommonName = errors.New("empty common name")
ErrEmptyCommonName is returned when common name is not provided for key generation.
Functions ¶
func Delete ¶
func Delete(url string, options ...SendOption) (*http.Response, error)
Delete sends a DELETE http request.
func Get ¶
func Get(url string, options ...SendOption) (*http.Response, error)
Get sends a GET http request.
func Head ¶
func Head(url string, options ...SendOption) (*http.Response, error)
Head sends a HEAD http request.
func IsAccepted ¶
IsAccepted returns true if err is a "status accepted" StatusError.
func IsConflict ¶
IsConflict returns true if err is a "status conflict" StatusError.
func IsForbidden ¶
IsForbidden returns true if statis code is 403 "forbidden"
func IsNetworkError ¶
IsNetworkError returns true if err is a NetworkError.
func IsNotFound ¶
IsNotFound returns true if err is a "not found" StatusError.
func IsRetryable ¶ added in v0.4.0
IsRetryable returns true if the statis code indicates that the request is retryable.
func Patch ¶
func Patch(url string, options ...SendOption) (*http.Response, error)
Patch sends a PATCH http request.
func Post ¶
func Post(url string, options ...SendOption) (*http.Response, error)
Post sends a POST http request.
Types ¶
type NetworkError ¶
type NetworkError struct {
// contains filtered or unexported fields
}
NetworkError occurs on any Send error which occurred while trying to send the HTTP request, e.g. the given host is unresponsive.
func (NetworkError) Error ¶
func (e NetworkError) Error() string
type RetryOption ¶
type RetryOption func(*retryOptions)
RetryOption allows overriding defaults for the SendRetry option.
func RetryBackoff ¶ added in v0.1.1
func RetryBackoff(b backoff.BackOff) RetryOption
RetryBackoff adds exponential backoff between retries.
func RetryCodes ¶ added in v0.4.0
func RetryCodes(codes ...int) RetryOption
RetryCodes adds more status codes to be retried (in addition to the default retryableCodes).
type Secret ¶
type Secret struct {
Path string `yaml:"path"`
}
Secret contains secret path configuration.
type SendOption ¶
type SendOption func(*sendOptions)
SendOption allows overriding defaults for the Send function.
func DisableHTTPFallback ¶ added in v0.1.10
func DisableHTTPFallback() SendOption
DisableHTTPFallback disables http fallback when https request fails.
func SendAcceptedCodes ¶
func SendAcceptedCodes(codes ...int) SendOption
SendAcceptedCodes specifies accepted codes for http request
func SendClient ¶
func SendClient(client *http.Client) SendOption
SendClient specifies a http client.
func SendContext ¶
func SendContext(ctx context.Context) SendOption
SendContext sets the context for the HTTP client.
func SendHeaders ¶
func SendHeaders(headers map[string]string) SendOption
SendHeaders specifies headers for http request
func SendRedirect ¶
SendRedirect specifies a redirect policy for http request
func SendRetry ¶
func SendRetry(options ...RetryOption) SendOption
SendRetry will we retry the request on network / 5XX errors.
func SendTLS ¶
func SendTLS(config *tls.Config) SendOption
SendTLS sets the transport with TLS config for the HTTP client.
func SendTLSTransport ¶
func SendTLSTransport(transport http.RoundTripper) SendOption
SendTLSTransport sets the transport with TLS config for the HTTP client.
func SendTimeout ¶
func SendTimeout(timeout time.Duration) SendOption
SendTimeout specifies timeout for http request
func SendTransport ¶
func SendTransport(transport http.RoundTripper) SendOption
SendTransport sets the transport for the HTTP client.
type StatusError ¶
type StatusError struct { Method string URL string Status int Header http.Header ResponseDump string }
StatusError occurs if an HTTP response has an unexpected status code.
func NewStatusError ¶
func NewStatusError(resp *http.Response) StatusError
NewStatusError returns a new StatusError.
func (StatusError) Error ¶
func (e StatusError) Error() string