request

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: Apache-2.0 Imports: 15 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"
	RequestKind     = HTTPRequestKind
)

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 Decoder added in v0.3.0

type Decoder = body.Decoder

type DecoderFunc added in v0.3.0

type DecoderFunc = body.DecoderFunc

type DecoderRegistry added in v0.3.0

type DecoderRegistry = body.DecoderRegistry

func NewDecoderRegistry added in v0.3.0

func NewDecoderRegistry() *DecoderRegistry

type FieldDecoder added in v0.3.0

type FieldDecoder = body.FieldDecoder

type Option

type Option func(*Scope)

func WithBodySource

func WithBodySource(source *body.Source) Option

func WithCookies

func WithCookies(values map[string]string) Option

func WithDecoder added in v0.3.0

func WithDecoder(mediaType string, decoder Decoder) 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 WithMaxMultipartMemory added in v0.3.0

func WithMaxMultipartMemory(size int64) Option

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 NewDeferred added in v0.4.0

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

NewDeferred opts this invocation into demand-driven body/form initialization. New retains its eager construction and option timing. Metadata providers do not read bytes; the full raw-request capability snapshots and rewinds them.

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) Request added in v0.3.0

func (s *Scope) Request() 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