querylimits

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package querylimits provides query parameter guardrails.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorWriter

type ErrorWriter func(http.ResponseWriter, int, httpx.Problem)

ErrorWriter allows overriding how validation errors are written.

type Middleware

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

Middleware enforces query parameter limits.

func New

func New(opts Options) (*Middleware, error)

New constructs a query limits middleware with safe defaults.

func (*Middleware) Handler

func (m *Middleware) Handler(next http.Handler) http.Handler

Handler wraps the next handler with query guardrails.

func (*Middleware) Middleware

func (m *Middleware) Middleware() func(http.Handler) http.Handler

Middleware implements ports.Middleware via Handler adapter.

type Options

type Options struct {
	MaxParams      int
	MaxKeyLength   int
	MaxValueLength int
	LimitParam     string
	MaxLimit       int
	ErrorWriter    ErrorWriter
}

Options configures query parameter limits.

Jump to

Keyboard shortcuts

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