prerequest

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(req *restfile.Request, out Output) error

Apply mutates req with pre-request script output.

func Normalize

func Normalize(out *Output)

func SetRequestVars added in v1.0.0

func SetRequestVars(req *restfile.Request, variables vars.NameMap[string])

SetRequestVars merges script writes into request-scoped variables. Names are matched case-insensitively after trimming whitespace. New variables are appended in deterministic order.

Types

type Input

type Input struct {
	Request   *restfile.Request
	Variables map[string]string
	Globals   vars.Globals
	BaseDir   string
	Context   context.Context
	Secrets   *vars.Secrets
}

Input is the host state available to a pre-request script runner.

type Output

type Output struct {
	Headers http.Header
	// Removals are tracked separately because headers declared in the file are
	// not part of Headers and would otherwise survive the script.
	HeaderDels map[string]struct{}
	Query      map[string]string
	Body       *string
	URL        *string
	Method     *string
	// Variables contains script writes, normalized to one entry per name.
	Variables vars.NameMap[string]
	Globals   vars.Globals
}

Output is the request mutation set produced by pre-request scripts.

func (*Output) AddHeader added in v1.0.0

func (o *Output) AddHeader(name, value string)

func (*Output) DelHeader added in v1.0.0

func (o *Output) DelHeader(name string)

func (*Output) SetHeader added in v1.0.0

func (o *Output) SetHeader(name, value string)

func (*Output) SetQuery added in v1.0.0

func (o *Output) SetQuery(name, value string)

Jump to

Keyboard shortcuts

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