httpscenario

package
v0.5.23 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: MPL-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EmptyTag = "__EMPTY__"
)

Variables

This section is empty.

Functions

func Import

func Import(fs afero.Fs)

func WrapGun

func WrapGun(g Gun) core.Gun

Types

type Gun

type Gun interface {
	Shoot(ammo *Scenario)
	Bind(sample netsample.Aggregator, deps core.GunDeps) error
	WarmUp(opts *warmup.Options) (any, error)
}

type Postprocessor

type Postprocessor interface {
	Process(resp *http.Response, body io.Reader) (map[string]any, error)
}

type Preprocessor

type Preprocessor interface {
	// Process is called before request is sent
	// templateVars - variables from template. Can be modified
	// sourceVars - variables from sources. Must NOT be modified
	Process(templateVars map[string]any) (map[string]any, error)
}

type Request added in v0.5.18

type Request struct {
	Method         string
	Headers        map[string]string
	Tag            string
	Body           *string
	Name           string
	URI            string
	Preprocessor   Preprocessor
	Postprocessors []Postprocessor
	Templater      Templater
	Sleep          time.Duration
}

func (*Request) GetBody added in v0.5.18

func (r *Request) GetBody() []byte

func (*Request) GetHeaders added in v0.5.18

func (r *Request) GetHeaders() map[string]string

type RequestParts

type RequestParts struct {
	URL     string
	Method  string
	Body    []byte
	Headers map[string]string
}

type Scenario added in v0.5.18

type Scenario struct {
	Requests        []Request
	ID              uint64
	Name            string
	MinWaitingTime  time.Duration
	VariableStorage SourceStorage
}

func (*Scenario) Clone added in v0.5.22

func (a *Scenario) Clone() scenario.ProvAmmo

func (*Scenario) SetID added in v0.5.18

func (a *Scenario) SetID(id uint64)

type ScenarioGun added in v0.5.22

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

func NewHTTP2Gun

func NewHTTP2Gun(conf phttp.HTTPGunConfig, answLog *zap.Logger, targetResolved string) (*ScenarioGun, error)

NewHTTP2Gun return simple HTTP/2 gun that can shoot sequentially through one connection.

func NewHTTPGun

func NewHTTPGun(conf phttp.HTTPGunConfig, answLog *zap.Logger, targetResolved string) *ScenarioGun

func (*ScenarioGun) Bind added in v0.5.22

func (g *ScenarioGun) Bind(aggregator netsample.Aggregator, deps core.GunDeps) error

func (*ScenarioGun) Close added in v0.5.22

func (g *ScenarioGun) Close() error

func (*ScenarioGun) Do added in v0.5.22

func (g *ScenarioGun) Do(req *http.Request) (*http.Response, error)

func (*ScenarioGun) Shoot added in v0.5.22

func (g *ScenarioGun) Shoot(ammo *Scenario)

Shoot is thread safe if Do and Connect hooks are thread safe.

func (*ScenarioGun) WarmUp added in v0.5.22

func (g *ScenarioGun) WarmUp(opts *warmup.Options) (any, error)

type SourceStorage added in v0.5.18

type SourceStorage interface {
	Variables() map[string]any
}

type Templater

type Templater interface {
	Apply(request *RequestParts, variables map[string]any, scenarioName, stepName string) error
}

Jump to

Keyboard shortcuts

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