pathvariant

package
v0.16.5 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package pathvariant lists the other ways a server or router may read an escaped request path.

Routers disagree on percent-encoding and path cleaning. net/http ServeMux decodes each segment before comparing it, gin and gorilla/mux route on the fully decoded path, chi and echo route on the escaped path, and some routers remove empty and dot segments. A validator that reads a path one way, in front of a router that reads it another, can validate one operation while the router runs a different one. Comparing the operation selected by each reading closes that gap.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollapseSlashes

func CollapseSlashes(p string) string

CollapseSlashes replaces each run of slashes in a path with a single slash.

func Variants

func Variants(escapedPath string) []string

Variants returns the readings of an escaped request path that differ from the path as sent: with percent-encoded path characters decoded, with encoded slashes also decoded, and each of those with empty and dot segments removed. It returns nil when every reading is the path itself.

Types

This section is empty.

Jump to

Keyboard shortcuts

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