query

package
v1.5.0 Latest Latest
Warning

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

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

Documentation

Overview

Package query evaluates queries (`status`, `header`, `jsonpath`, …) on the responses of an entry.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	// Responses is the redirect chain; the last one is the final response.
	Responses []*exchange.Response
	Env       *template.Env
	// NoJSONPathCoercion keeps a jsonpath result the list of matches,
	// even for no match or a single one.
	NoJSONPathCoercion bool
	// contains filtered or unexported fields
}

Context evaluates the queries of one entry. It caches the parsed body, so it must not be shared between entries or goroutines.

func NewContext

func NewContext(responses []*exchange.Response, env *template.Env) *Context

NewContext returns a context for the responses of an entry (at least one).

func (*Context) Eval

func (c *Context) Eval(q *syntax.Query) (value.Value, error)

Eval evaluates q. A nil value means the query returned nothing.

Jump to

Keyboard shortcuts

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