exec

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StageCaptures = "captures"
)

Variables

View Source
var ErrPollTimeout = errors.New("poll deadline exceeded")

ErrPollTimeout is returned when @poll reaches its timeout. The result may still contain the last response.

Functions

This section is empty.

Types

type CaptureInput

type CaptureInput struct {
	Doc      *restfile.Document
	Req      *restfile.Request
	Resolver *vars.Resolver
	Response *scripts.Response
	HTTP     *httpx.Response
	Stream   *scripts.StreamInfo
	Locals   rts.Locals
}

type HTTPHooks

type HTTPHooks struct {
	AttachSSEHandle       func(*httpx.StreamHandle, *restfile.Request)
	AttachWebSocketHandle func(*httpx.WebSocketHandle, *restfile.Request)
	ApplyCaptures         func(CaptureInput) error
	// CollectVariables rebuilds variables after pre-request scripts; the third
	// argument contains their writes at script precedence.
	CollectVariables  func(*restfile.Document, *restfile.Request, vars.NameMap[string]) map[string]string
	RunTests          func(TestInput) ([]scriptapi.TestResult, error)
	EvaluatePredicate func(PredicateInput) (bool, error)
	OnRepeatProgress  func(RepeatProgress)
	Warn              func(string)
}

type HTTPInput

type HTTPInput struct {
	Client           *httpx.Client
	Context          context.Context
	Doc              *restfile.Document
	Req              *restfile.Request
	Resolver         *vars.Resolver
	Options          httpx.Options
	EffectiveTimeout time.Duration
	ScriptVars       vars.NameMap[string]
	Locals           rts.Locals
}

type HTTPResult

type HTTPResult struct {
	Response  *httpx.Response
	Stream    *scripts.StreamInfo
	Tests     []scriptapi.TestResult
	ScriptErr error
	Err       error
	Decision  string
	ErrStage  string
	Repeat    RepeatCount
}

type PredicateInput added in v1.4.0

type PredicateInput struct {
	Context   context.Context
	Doc       *restfile.Document
	Req       *restfile.Request
	BaseDir   string
	Vars      map[string]string
	Locals    rts.Locals
	HTTP      *httpx.Response
	Predicate restfile.ResponsePredicate
}

type RepeatCount added in v1.4.0

type RepeatCount struct {
	Attempts int
	Polls    int
}

type RepeatPhase added in v1.4.0

type RepeatPhase uint8
const (
	RepeatAttempt RepeatPhase = iota
	RepeatRetryWait
	RepeatPollWait
)

type RepeatProgress added in v1.4.0

type RepeatProgress struct {
	Phase      RepeatPhase
	Attempt    int
	Poll       int
	StatusCode int
	Delay      time.Duration
	Err        error
}

type RequestFlow

type RequestFlow interface {
	PendingCancel() *RequestResult
	Finish()
	EvaluateRunVars() *RequestResult
	EvaluateCondition() *RequestResult
	RunPreRequest() *RequestResult
	PrepareRequest() *RequestResult
	PreviewResult() RequestResult
	UseGRPC() bool
	IsInteractiveWebSocket() bool
	ExecuteInteractiveWebSocket() RequestResult
	ExecuteGRPC() RequestResult
	ExecuteHTTP() RequestResult
}

type RequestResult

type RequestResult struct {
	Response       *httpx.Response
	GRPC           *grpcx.Response
	Stream         *scripts.StreamInfo
	Transcript     []byte
	Err            error
	Tests          []scriptapi.TestResult
	ScriptErr      error
	Checked        bool
	Executed       *restfile.Request
	RequestText    string
	RuntimeSecrets []string
	Environment    string
	Selection      vars.Selection
	Skipped        bool
	SkipReason     string
	Preview        bool
	Explain        *explain.Report
	Timing         engine.Timing
}

func RunRequest

func RunRequest(flow RequestFlow) RequestResult

type Runner

type Runner struct {
	Hooks HTTPHooks
}

func (Runner) RunHTTP

func (r Runner) RunHTTP(in HTTPInput) HTTPResult

type TestInput added in v1.15.0

type TestInput struct {
	Context  context.Context
	Response *scripts.Response
	HTTP     *httpx.Response
	Stream   *scripts.StreamInfo
}

Jump to

Keyboard shortcuts

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