request

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Overview

Package request composes independently scoped HTTP value providers while preserving the original request pointer for handler capabilities.

Index

Constants

View Source
const (
	QueryKind       = "query"
	PathKind        = "path"
	HeaderKind      = "header"
	CookieKind      = "cookie"
	FormKind        = "form"
	BodyKind        = "body"
	HTTPRequestKind = "http_request"
)

Variables

This section is empty.

Functions

func WithQueryPolicy

func WithQueryPolicy(ctx context.Context, policy QueryPolicy) context.Context

WithQueryPolicy overrides scope defaults for this invocation only.

Types

type Option

type Option func(*Scope)

func WithBodySource

func WithBodySource(source *body.Source) Option

func WithCookies

func WithCookies(values map[string]string) Option

func WithForm

func WithForm(values url.Values) Option

func WithHeaders

func WithHeaders(values http.Header) Option

func WithIgnoreEmptyQueryParameters

func WithIgnoreEmptyQueryParameters(ignore bool) Option

WithIgnoreEmptyQueryParameters treats a single empty query value as absent. Repeated values and other provider kinds retain their authored presence.

func WithPathParams

func WithPathParams(values map[string]string) Option

func WithQuery

func WithQuery(values url.Values) Option

type QueryPolicy

type QueryPolicy struct{ IgnoreEmptyParameters bool }

QueryPolicy is invocation-local query presence policy.

type Scope

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

func New

func New(request *http.Request, options ...Option) (*Scope, error)

func NewValues

func NewValues(options ...Option) *Scope

func (*Scope) Body

func (s *Scope) Body() *body.Source

func (*Scope) Close

func (s *Scope) Close() error

func (*Scope) Cookie

func (s *Scope) Cookie() locator.Provider

func (*Scope) Form

func (s *Scope) Form() locator.Provider

func (*Scope) Header

func (s *Scope) Header() locator.Provider

func (*Scope) Path

func (s *Scope) Path() locator.Provider

func (*Scope) Providers

func (s *Scope) Providers() []locator.Provider

func (*Scope) Query

func (s *Scope) Query() locator.Provider

func (*Scope) WithHeader

func (s *Scope) WithHeader(name, value string) *Scope

WithHeader returns a detached header overlay. The underlying request pointer and all other source values retain their invocation identity.

Jump to

Keyboard shortcuts

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