Help us shape the future of Go! Take the 2026 Go Developer Survey

route

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package route provides an enumerable case-insensitive protocol router.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Query

func Query(values url.Values, name string) []string

Query returns all values for keys matching name case-insensitively.

Types

type Route

type Route = conform.Route

type Router

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

func (*Router) Handle

func (r *Router) Handle(method, pattern string, h http.Handler) error

Handle registers a literal/parameter route. Parameters use {name}; a final {name...} captures the remaining path. Duplicate patterns are rejected.

func (*Router) Routes

func (r *Router) Routes() []Route

func (*Router) ServeHTTP

func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request)

func (*Router) SetUnmatched

func (r *Router) SetUnmatched(observer func(*http.Request, int))

SetUnmatched installs an optional observer for 404 and 405 responses. The observer is called without the router lock and must redact and rate-limit any request information it records.

Jump to

Keyboard shortcuts

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