request

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: 50 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthSecretValues added in v0.27.2

func AuthSecretValues(auth *restfile.AuthSpec, res *vars.Resolver) []string

func CloneRequest

func CloneRequest(req *restfile.Request) *restfile.Request

Execution normalizes and mutates requests, so every run starts with its own working copy.

func CommandAuthSecrets added in v0.27.2

func CommandAuthSecrets(res authcmd.Result) []string

func InjectedAuthHeaders added in v1.5.0

func InjectedAuthHeaders(before, after *restfile.Request) []string

func InjectedAuthSecrets added in v0.27.2

func InjectedAuthSecrets(
	auth *restfile.AuthSpec,
	before *restfile.Request,
	after *restfile.Request,
) []string

func RedactSecrets added in v1.14.0

func RedactSecrets(s string, secs []string) string

RedactSecrets masks each secret and the escaped forms a URL query or path gives it.

func RenderRequestText

func RenderRequestText(req *restfile.Request) string

func ResolveEnvironment added in v1.2.0

func ResolveEnvironment(
	src vars.Environment,
	doc *restfile.Document,
	req *restfile.Request,
) vars.ResolvedEnv

ResolveEnvironment snapshots every declared env: reference for one run, including unused values that may need redaction.

Types

type Engine

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

func New

func New(cfg engine.Config, rt *rtrun.Runtime) *Engine

func (*Engine) ApplyPatches added in v0.44.1

func (e *Engine) ApplyPatches(
	ctx context.Context,
	doc *restfile.Document,
	req *restfile.Request,
	src vars.Environment,
	base string,
	vv map[string]string,
	locals rts.Locals,
) error

func (*Engine) BuildCommandAuthConfig added in v0.27.2

func (e *Engine) BuildCommandAuthConfig(
	doc *restfile.Document,
	auth *restfile.AuthSpec,
	res *vars.Resolver,
	timeout time.Duration,
) (authcmd.Config, error)

func (*Engine) BuildOAuthConfig added in v0.27.2

func (e *Engine) BuildOAuthConfig(
	auth *restfile.AuthSpec,
	res *vars.Resolver,
) (oauth.Config, error)

func (*Engine) CollectVariables

func (e *Engine) CollectVariables(
	doc *restfile.Document,
	req *restfile.Request,
	env vars.Environment,
	sc RunScope,
) map[string]string

func (*Engine) DisplayResolver added in v0.48.1

func (e *Engine) DisplayResolver(
	ctx context.Context,
	doc *restfile.Document,
	req *restfile.Request,
	src vars.Environment,
	base string,
	locals rts.Locals,
) *vars.Resolver

DisplayResolver uses normal variable precedence for UI text but leaves out known secret values so labels and previews do not expose them.

func (*Engine) EnsureCommandAuth added in v0.27.2

func (e *Engine) EnsureCommandAuth(
	ctx context.Context,
	doc *restfile.Document,
	req *restfile.Request,
	res *vars.Resolver,
	env vars.ResolvedEnv,
	timeout time.Duration,
) (authcmd.Result, error)

func (*Engine) EnsureOAuth added in v0.27.2

func (e *Engine) EnsureOAuth(
	ctx context.Context,
	req *restfile.Request,
	res *vars.Resolver,
	opts httpx.Options,
	env vars.ResolvedEnv,
	timeout time.Duration,
) (string, error)

func (*Engine) EvalCondition

func (e *Engine) EvalCondition(
	ctx context.Context,
	d RunDoc,
	req *restfile.Request,
	src vars.Environment,
	base string,
	spec *restfile.ConditionSpec,
	vv map[string]string,
	locals rts.Locals,
) (bool, string, error)

func (*Engine) EvalForEachItems

func (e *Engine) EvalForEachItems(
	ctx context.Context,
	d RunDoc,
	req *restfile.Request,
	src vars.Environment,
	base string,
	spec ForEachSpec,
	vv map[string]string,
	locals rts.Locals,
) ([]rts.Value, error)

func (*Engine) EvalRunVars added in v1.9.0

func (e *Engine) EvalRunVars(
	ctx context.Context,
	d RunDoc,
	req *restfile.Request,
	src vars.Environment,
	sc RunScope,
	decls []restfile.RunVar,
) (vars.NameMap[string], error)

EvalRunVars returns the new values alongside those already in sc.RunVars.

func (*Engine) EvalValue

func (e *Engine) EvalValue(ctx context.Context, in EvalInput) (rts.Value, error)

func (*Engine) Execute

func (e *Engine) Execute(
	doc *restfile.Document,
	req *restfile.Request,
	env vars.Environment,
) (engine.RequestResult, error)

func (*Engine) ExecuteWith

func (e *Engine) ExecuteWith(
	doc *restfile.Document,
	req *restfile.Request,
	src vars.Environment,
	opt ExecOptions,
) (engine.RequestResult, error)

func (*Engine) ExprEval added in v0.44.1

func (e *Engine) ExprEval(ctx context.Context, in ExprInput) vars.ExprEval

ExprEval returns a {{= expr }} evaluator with default policy.

func (*Engine) ExprEvalWithOptions added in v0.44.1

func (e *Engine) ExprEvalWithOptions(
	ctx context.Context,
	in ExprInput,
	opt ExprEvalOptions,
) vars.ExprEval

ExprEvalWithOptions is ExprEval with an explicit evaluation policy.

func (*Engine) ForRun added in v0.49.1

func (e *Engine) ForRun(
	cfg engine.Config,
	resp *httpx.Response,
	grpc *grpcx.Response,
) *Engine

ForRun returns an engine view for a single execution, so preparing the next run cannot rewrite what a request in flight is reading. Fields are listed rather than the struct copied to keep shared and per-run state an explicit choice.

func (*Engine) PrepareCommandAuth added in v0.27.2

func (e *Engine) PrepareCommandAuth(
	doc *restfile.Document,
	auth *restfile.AuthSpec,
	res *vars.Resolver,
	env vars.ResolvedEnv,
	timeout time.Duration,
) (authcmd.Prepared, error)

func (*Engine) PrepareExplainAuthPreview added in v0.27.2

func (e *Engine) PrepareExplainAuthPreview(
	doc *restfile.Document,
	req *restfile.Request,
	res *vars.Resolver,
	env vars.ResolvedEnv,
) (ExplainAuthPreviewResult, error)

func (*Engine) ResolveInheritedAuth added in v0.27.2

func (e *Engine) ResolveInheritedAuth(doc *restfile.Document, req *restfile.Request)

func (*Engine) ResolveOAuthConfig added in v0.27.2

func (e *Engine) ResolveOAuthConfig(
	auth *restfile.AuthSpec,
	res *vars.Resolver,
	env vars.ResolvedEnv,
) (oauth.Config, error)

func (*Engine) RunDoc added in v1.15.0

func (e *Engine) RunDoc(doc *restfile.Document) RunDoc

func (*Engine) RunPreRequest added in v0.44.1

func (e *Engine) RunPreRequest(
	ctx context.Context,
	doc *restfile.Document,
	req *restfile.Request,
	env vars.Environment,
	base string,
	vv map[string]string,
	locals rts.Locals,
	globals vars.Globals,
) (prerequest.Output, error)

func (*Engine) ValueString

func (e *Engine) ValueString(ctx context.Context, pos rts.Pos, v rts.Value) (string, error)

type EvalInput added in v0.49.1

type EvalInput struct {
	RunDoc
	Req    *restfile.Request
	Env    vars.ResolvedEnv
	Base   string
	Expr   string
	Site   string
	Pos    rts.Pos
	Vars   map[string]string
	Locals rts.Locals
	// contains filtered or unexported fields
}

EvalInput is one expression evaluation. Expr is the source to evaluate, Site is the directive text it came from, used in diagnostics.

type ExecMode

type ExecMode uint8
const (
	ExecModeSend ExecMode = iota
	ExecModePreview
)

type ExecOptions

type ExecOptions struct {
	Run        *RunScope
	Locals     rts.Locals
	Record     bool
	Ctx        context.Context
	Mode       ExecMode
	OnWarning  func(Warning)
	OnRepeat   func(xexec.RepeatProgress)
	AttachSSE  func(*httpx.StreamHandle, *restfile.Request)
	AttachWS   func(*httpx.WebSocketHandle, *restfile.Request)
	AttachGRPC func(*stream.Session, *restfile.Request)
}

type ExplainAuthPreviewResult added in v0.27.2

type ExplainAuthPreviewResult struct {
	Status       xplain.StageStatus
	Summary      string
	Notes        []string
	ExtraSecrets []string
}

type ExprEvalOptions added in v0.44.1

type ExprEvalOptions struct {
	// OmitSecretGlobals drops secret global values from the runtime so preview
	// and status evaluation cannot expose them.
	OmitSecretGlobals bool
}

ExprEvalOptions tunes how a {{= expr }} evaluator treats the RTS runtime.

type ExprInput added in v0.49.1

type ExprInput struct {
	Doc *restfile.Document

	Req      *restfile.Request
	Env      vars.ResolvedEnv
	Base     string
	Vars     map[string]string
	Response *rtshost.Response
	Stream   *rtshost.Stream
	Locals   rts.Locals
	// contains filtered or unexported fields
}

ExprInput contains the request data available to a {{= expr }} expression.

type ForEachSpec

type ForEachSpec struct {
	Expr string
	Var  string
	Line int
}

type RunDoc added in v1.15.0

type RunDoc struct {
	Doc  *restfile.Document
	File *rts.File
}

RunDoc is a document as one run reads it. A run makes one where it starts and passes it on, so its positions in Doc share one File and the text it read.

func (RunDoc) At added in v1.15.0

func (d RunDoc) At(req *restfile.Request, line int) rts.Pos

At returns the start of line. Without a line it is the start of req.

type RunScope added in v1.9.0

type RunScope struct {
	Overlay vars.NameMap[string]
	RunVars vars.NameMap[string]
}

RunScope carries workflow and loop values, plus run values already fixed.

type SecretSources added in v1.2.0

type SecretSources struct {
	Doc      *restfile.Document
	Req      *restfile.Request
	Env      vars.ResolvedEnv
	FilePath string
	Files    *rtrun.Files
	Globals  *rtrun.Globals
	Extra    []string
}

SecretSources collects values that must be redacted from run output.

func (SecretSources) Secrets added in v1.2.0

func (s SecretSources) Secrets() []string

Secrets returns values longest first so overlapping secrets are fully masked.

type Warning added in v0.48.1

type Warning string
const WarningSSHHostKeyVerificationDisabled Warning = "@ssh strict_hostkey=false (insecure)"

Jump to

Keyboard shortcuts

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