internal

package
v0.0.0-...-8c81104 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package internal implements internal functionality for the proxy client.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrWildcardMustBeLast = errors.New(
		"wildcard '*' must be the last value in a route. trim trailing text or use a '{param}' instead",
	)
	ErrMissingClosingBracket            = errors.New("route param closing delimiter '}' is missing")
	ErrParamKeyRequired                 = errors.New("param key must not be empty")
	ErrDuplicatedParamKey               = errors.New("routing pattern contains duplicate param key")
	ErrInvalidParamPattern              = errors.New("invalid param pattern")
	ErrDuplicatedRoutingPattern         = errors.New("routing pattern is duplicated")
	ErrInvalidRegexpPatternParamInRoute = errors.New("invalid regexp pattern in route param")
	ErrReplaceMissingChildNode          = errors.New("replacing missing child node")
)

Functions

This section is empty.

Types

type MethodHandler

type MethodHandler struct {
	Operation *oaschema.Operation
	Handler   proxyhandler.ProxyHandler
}

MethodHandler represents a handler data for a method.

type Node

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

Node presents the route tree to organize the recursive route structure.

func (*Node) FindRoute

func (n *Node) FindRoute(path string, method string) (*Route, *httperror.HTTPError)

func (*Node) InsertRoute

func (n *Node) InsertRoute(
	document *highv3.Document,
	pattern string,
	operations *highv3.PathItem,
	options *proxyhandler.InsertRouteOptions,
) (*Node, error)

InsertRoute parses the route pattern into tree nodes and creates handlers.

func (Node) String

func (n Node) String() string

String implements the fmt.Stringer interface to print debug data.

type Route

type Route struct {
	Pattern     string
	Method      *MethodHandler
	ParamValues map[string]any
}

Route holds parameter values from the request path.

func (Route) IsRequestBodyRequired

func (r Route) IsRequestBodyRequired() bool

IsRequestBodyRequired checks if the request body of this route is required.

Jump to

Keyboard shortcuts

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