diff options
| author | Stefan Majewsky <majewsky@gmx.net> | 2026-06-27 22:34:36 +0200 |
|---|---|---|
| committer | Stefan Majewsky <majewsky@gmx.net> | 2026-06-27 22:34:36 +0200 |
| commit | 8e9889d3e5b2874854832d1d882d124132546f49 (patch) | |
| tree | 80ab6bf53dac3090630ad58d7ebfbbf2c97019ca /pathrouter/utils.go | |
| parent | 8804729561d8e5edd7179f494d89c620459d319f (diff) | |
| download | go-gg-8e9889d3e5b2874854832d1d882d124132546f49.tar.gz | |
add package pathrouter
Diffstat (limited to 'pathrouter/utils.go')
| -rw-r--r-- | pathrouter/utils.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/pathrouter/utils.go b/pathrouter/utils.go new file mode 100644 index 0000000..e8704a7 --- /dev/null +++ b/pathrouter/utils.go @@ -0,0 +1,22 @@ +// SPDX-FileCopyrightText: 2026 Stefan Majewsky <majewsky@gmx.net> +// SPDX-License-Identifier: Apache-2.0 + +package pathrouter + +import ( + "fmt" + "net/url" +) + +func pathUnescape(in string) string { + out, err := url.PathUnescape(in) + if err != nil { + // defense in depth: should not fail because `in` was indirectly obtained from r.URL.EscapedPath() + panic(fmt.Sprintf("PathUnescape failed on %q: %s", in, err.Error())) + } + return out +} + +func increment(x int) int { + return x + 1 +} |
