httprequest

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2021 License: GPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithAuth

func WithAuth(user, password string) func(*Config)

WithAuth defines user and password that is used for Basic Auth.

Types

type Config

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

Config is the configuration of a HTTP-Request action.

func NewConfigFromMap

func NewConfigFromMap(m map[string]interface{}) (*Config, error)

NewConfigFromMap instantiates a config from a configuration map. The map is usually the unmarshalled rules configuration file.

func (*Config) DetailedString

func (c *Config) DetailedString() string

func (*Config) String

func (c *Config) String() string

func (*Config) Template

func (h *Config) Template(fn func(string) (string, error)) (action.Runner, error)

Template runs the fn callback on all configuration options that can contain template strings. fn must replace the template strings. It returns an executable action that uses the templated config.

type ErrorHTTPRequest

type ErrorHTTPRequest struct {
	Body   []byte
	Status int
}

func (*ErrorHTTPRequest) Error

func (e *ErrorHTTPRequest) Error() string

type Runner

type Runner struct {
	*Config
}

Runner executes a http request.

func (*Runner) LogFields

func (h *Runner) LogFields() []zap.Field

LogFields returns fields that should be used when logging messages related to the action.

func (*Runner) Run

func (h *Runner) Run(ctx context.Context) error

Run sends the http request. It returns an ErrorHTTPRequest if request related error happens.

func (*Runner) String

func (h *Runner) String() string

Jump to

Keyboard shortcuts

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