http

package
v2.14.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// DefaultConnectionTimeout is the default connection timeout duration
	DefaultConnectionTimeout = 3 * time.Second
	// DefaultInsecureSkipTLSVerify is the default insecure skip tls verify
	DefaultInsecureSkipTLSVerify = false
	// DefaultNoRedirect is the default auto redirect
	DefaultNoRedirect = false
)

Variables

This section is empty.

Functions

func New

func New(address string, opts ...Option) checker.Checker

New creates the HTTP checker

Types

type HTTP

type HTTP struct {
	// contains filtered or unexported fields
}

HTTP represents HTTP checker

func (*HTTP) Check

func (h *HTTP) Check(ctx context.Context) (err error)

Check checks HTTP connection

func (*HTTP) Identity

func (h *HTTP) Identity() (string, error)

Identity returns the identity of the checker

type Option

type Option func(h *HTTP)

Option configures an HTTP.

func WithExpectBodyJSON

func WithExpectBodyJSON(json string) Option

WithExpectBodyJSON configures response json expectation

func WithExpectBodyRegex

func WithExpectBodyRegex(regex string) Option

WithExpectBodyRegex configures response body expectation

func WithExpectBodyXPath

func WithExpectBodyXPath(xpath string) Option

WithExpectBodyXPath configures response xpath expectation

func WithExpectHeader

func WithExpectHeader(header string) Option

WithExpectHeader configures response header expectation

func WithExpectStatusCode

func WithExpectStatusCode(code int) Option

WithExpectStatusCode configures response status code expectation

func WithInsecureSkipTLSVerify

func WithInsecureSkipTLSVerify(insecureSkipTLSVerify bool) Option

WithInsecureSkipTLSVerify configures insecure skip tls verify

func WithNoRedirect

func WithNoRedirect(noRedirect bool) Option

WithNoRedirect configures auto redirect

func WithRequestBody

func WithRequestBody(body io.Reader) Option

WithRequestBody configures request body

func WithRequestHeader

func WithRequestHeader(key string, value []string) Option

WithRequestHeader configures request header

func WithRequestHeaders

func WithRequestHeaders(headers http.Header) Option

WithRequestHeaders configures request header

func WithTimeout

func WithTimeout(timeout time.Duration) Option

WithTimeout configures a time limit for requests made by the HTTP client

Jump to

Keyboard shortcuts

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