http

package
v0.36.4 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TYPE          = "http"
	DefaultMethod = "HEAD"
)

Variables

View Source
var ErrURLEmpty = errors.New("URL cannot be empty")

Functions

func NewRequestError

func NewRequestError(err error) error

func NewResponseError

func NewResponseError(err error) error

func NewUnexpectedStatusError

func NewUnexpectedStatusError(status int) error

Types

type Config

type Config struct {
	URL           string            `yaml:"url" json:"url" jsonschema:"required,title=URL to query"`
	Method        string            `yaml:"method" json:"method" jsonschema:"title=HTTP method,default=HEAD"`
	Body          string            `yaml:"body" json:"body" jsonschema:"title=HTTP body,default="`
	Headers       map[string]string `yaml:"headers" json:"headers" jsonschema:"title=HTTP headers to set"`
	ExpectedCodes []int             `yaml:"expected_codes" json:"expected_codes" jsonschema:"required,title=Expected response codes"`
	Insecure      bool              `yaml:"insecure" json:"insecure" jsonschema:"default=false"`
	// contains filtered or unexported fields
}

Config is the main monitor Config.

func NewConfig

func NewConfig() *Config

func (*Config) Init

func (c *Config) Init(_ context.Context, logger *log.Entry) error

func (*Config) Run

func (c *Config) Run(ctx context.Context) error

func (*Config) Validate

func (c *Config) Validate() error

type RequestError

type RequestError struct {
	Err error
}

func (RequestError) Error

func (err RequestError) Error() string

func (RequestError) Unwrap

func (err RequestError) Unwrap() error

type ResponseError

type ResponseError struct {
	Err error
}

func (ResponseError) Error

func (err ResponseError) Error() string

func (ResponseError) Unwrap

func (err ResponseError) Unwrap() error

type UnexpectedStatusError

type UnexpectedStatusError struct {
	StatusCode int
}

func (UnexpectedStatusError) Error

func (err UnexpectedStatusError) Error() string

Jump to

Keyboard shortcuts

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