scripts

package
v0.23.6 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GlobalValue added in v0.1.15

type GlobalValue struct {
	Name   string
	Value  string
	Secret bool
	Delete bool
}

type PreRequestInput

type PreRequestInput struct {
	Request   *restfile.Request
	Variables map[string]string
	Globals   map[string]GlobalValue
	BaseDir   string
	Context   context.Context
}

type PreRequestOutput

type PreRequestOutput struct {
	Headers   http.Header
	Query     map[string]string
	Body      *string
	URL       *string
	Method    *string
	Variables map[string]string
	Globals   map[string]GlobalValue
}

type Response added in v0.5.0

type Response struct {
	Kind            ResponseKind
	Status          string
	Code            int
	URL             string
	Time            time.Duration
	Header          http.Header
	Body            []byte
	Wire            []byte
	WireContentType string
	// ContentType carries the best-known type for the Body payload (may be empty).
	ContentType string
}

func (*Response) Clone added in v0.5.0

func (r *Response) Clone() *Response

type ResponseKind added in v0.5.0

type ResponseKind string
const (
	ResponseKindHTTP ResponseKind = "http"
	ResponseKindGRPC ResponseKind = "grpc"
)

type Runner

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

func NewRunner

func NewRunner(fs httpclient.FileSystem) *Runner

func (*Runner) RunPreRequest

func (r *Runner) RunPreRequest(
	scripts []restfile.ScriptBlock,
	input PreRequestInput,
) (PreRequestOutput, error)

func (*Runner) RunTests

func (r *Runner) RunTests(
	scripts []restfile.ScriptBlock,
	input TestInput,
) ([]TestResult, map[string]GlobalValue, error)

type StreamInfo added in v0.5.0

type StreamInfo struct {
	Kind    string
	Summary map[string]interface{}
	Events  []map[string]interface{}
}

StreamInfo carries streaming session data for script consumption.

func (*StreamInfo) Clone added in v0.5.0

func (info *StreamInfo) Clone() *StreamInfo

type TestInput

type TestInput struct {
	Response  *Response
	Variables map[string]string
	Globals   map[string]GlobalValue
	BaseDir   string
	Stream    *StreamInfo
	Trace     *TraceInput
}

type TestResult

type TestResult struct {
	Name    string
	Message string
	Passed  bool
	Elapsed time.Duration
}

type TraceBudget added in v0.6.0

type TraceBudget struct {
	Total     time.Duration
	Tolerance time.Duration
	Phases    map[string]time.Duration
}

TraceBudget represents optional latency budgets configured for a request.

type TraceInput added in v0.6.0

type TraceInput struct {
	Timeline *nettrace.Timeline
	Budgets  TraceBudget
}

TraceInput carries timeline and budget information into the scripting runtime.

func NewTraceInput added in v0.6.0

func NewTraceInput(tl *nettrace.Timeline, spec *restfile.TraceSpec) *TraceInput

NewTraceInput converts a timeline/spec pair into a scripting input, cloning data to keep it immutable.

Jump to

Keyboard shortcuts

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