From b5dfa4b6030898574cfa09716ed2b5f7a4ba6092 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Feb 2024 16:18:39 +0000 Subject: [PATCH] Bump github.com/go-chi/chi/v5 from 5.0.11 to 5.0.12 in /src Bumps [github.com/go-chi/chi/v5](https://github.com/go-chi/chi) from 5.0.11 to 5.0.12. - [Release notes](https://github.com/go-chi/chi/releases) - [Changelog](https://github.com/go-chi/chi/blob/master/CHANGELOG.md) - [Commits](https://github.com/go-chi/chi/compare/v5.0.11...v5.0.12) --- updated-dependencies: - dependency-name: github.com/go-chi/chi/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/go.mod | 2 +- src/go.sum | 4 ++-- .../github.com/go-chi/chi/v5/CHANGELOG.md | 5 +++++ src/vendor/github.com/go-chi/chi/v5/README.md | 2 ++ src/vendor/github.com/go-chi/chi/v5/mux.go | 16 +++++++++++++++ .../github.com/go-chi/chi/v5/path_value.go | 20 +++++++++++++++++++ .../go-chi/chi/v5/path_value_fallback.go | 19 ++++++++++++++++++ src/vendor/modules.txt | 2 +- 8 files changed, 66 insertions(+), 4 deletions(-) create mode 100644 src/vendor/github.com/go-chi/chi/v5/path_value.go create mode 100644 src/vendor/github.com/go-chi/chi/v5/path_value_fallback.go diff --git a/src/go.mod b/src/go.mod index 8e19fdbf7..de2b34ac0 100644 --- a/src/go.mod +++ b/src/go.mod @@ -22,7 +22,7 @@ require ( require ( code.cloudfoundry.org/go-loggregator/v9 v9.2.0 git.sr.ht/~nelsam/hel/v3 v3.0.4 - github.com/go-chi/chi/v5 v5.0.11 + github.com/go-chi/chi/v5 v5.0.12 github.com/google/go-cmp v0.6.0 github.com/onsi/ginkgo/v2 v2.15.0 go.opentelemetry.io/proto/otlp v1.1.0 diff --git a/src/go.sum b/src/go.sum index 33afb7151..4c7e18251 100644 --- a/src/go.sum +++ b/src/go.sum @@ -51,8 +51,8 @@ github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8 github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-chi/chi/v5 v5.0.11 h1:BnpYbFZ3T3S1WMpD79r7R5ThWX40TaFB7L31Y8xqSwA= -github.com/go-chi/chi/v5 v5.0.11/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= +github.com/go-chi/chi/v5 v5.0.12 h1:9euLV5sTrTNTRUU9POmDUvfxyj6LAABLUcEWO+JJb4s= +github.com/go-chi/chi/v5 v5.0.12/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= diff --git a/src/vendor/github.com/go-chi/chi/v5/CHANGELOG.md b/src/vendor/github.com/go-chi/chi/v5/CHANGELOG.md index 83d5aa28f..25b45b974 100644 --- a/src/vendor/github.com/go-chi/chi/v5/CHANGELOG.md +++ b/src/vendor/github.com/go-chi/chi/v5/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## v5.0.12 (2024-02-16) + +- History of changes: see https://github.com/go-chi/chi/compare/v5.0.11...v5.0.12 + + ## v5.0.11 (2023-12-19) - History of changes: see https://github.com/go-chi/chi/compare/v5.0.10...v5.0.11 diff --git a/src/vendor/github.com/go-chi/chi/v5/README.md b/src/vendor/github.com/go-chi/chi/v5/README.md index 4b1c99d12..21cbb0fc0 100644 --- a/src/vendor/github.com/go-chi/chi/v5/README.md +++ b/src/vendor/github.com/go-chi/chi/v5/README.md @@ -354,6 +354,7 @@ with `net/http` can be used with chi's mux. | [RouteHeaders] | Route handling for request headers | | [SetHeader] | Short-hand middleware to set a response header key/value | | [StripSlashes] | Strip slashes on routing paths | +| [Sunset] | Sunset set Deprecation/Sunset header to response | | [Throttle] | Puts a ceiling on the number of concurrent requests | | [Timeout] | Signals to the request context when the timeout deadline is reached | | [URLFormat] | Parse extension from url and put it on request context | @@ -380,6 +381,7 @@ with `net/http` can be used with chi's mux. [RouteHeaders]: https://pkg.go.dev/github.com/go-chi/chi/middleware#RouteHeaders [SetHeader]: https://pkg.go.dev/github.com/go-chi/chi/middleware#SetHeader [StripSlashes]: https://pkg.go.dev/github.com/go-chi/chi/middleware#StripSlashes +[Sunset]: https://pkg.go.dev/github.com/go-chi/chi/v5/middleware#Sunset [Throttle]: https://pkg.go.dev/github.com/go-chi/chi/middleware#Throttle [ThrottleBacklog]: https://pkg.go.dev/github.com/go-chi/chi/middleware#ThrottleBacklog [ThrottleWithOpts]: https://pkg.go.dev/github.com/go-chi/chi/middleware#ThrottleWithOpts diff --git a/src/vendor/github.com/go-chi/chi/v5/mux.go b/src/vendor/github.com/go-chi/chi/v5/mux.go index 735ab2323..6dc1904d9 100644 --- a/src/vendor/github.com/go-chi/chi/v5/mux.go +++ b/src/vendor/github.com/go-chi/chi/v5/mux.go @@ -107,12 +107,24 @@ func (mx *Mux) Use(middlewares ...func(http.Handler) http.Handler) { // Handle adds the route `pattern` that matches any http method to // execute the `handler` http.Handler. func (mx *Mux) Handle(pattern string, handler http.Handler) { + parts := strings.SplitN(pattern, " ", 2) + if len(parts) == 2 { + mx.Method(parts[0], parts[1], handler) + return + } + mx.handle(mALL, pattern, handler) } // HandleFunc adds the route `pattern` that matches any http method to // execute the `handlerFn` http.HandlerFunc. func (mx *Mux) HandleFunc(pattern string, handlerFn http.HandlerFunc) { + parts := strings.SplitN(pattern, " ", 2) + if len(parts) == 2 { + mx.Method(parts[0], parts[1], handlerFn) + return + } + mx.handle(mALL, pattern, handlerFn) } @@ -440,6 +452,10 @@ func (mx *Mux) routeHTTP(w http.ResponseWriter, r *http.Request) { // Find the route if _, _, h := mx.tree.FindRoute(rctx, method, routePath); h != nil { + if supportsPathValue { + setPathValue(rctx, r) + } + h.ServeHTTP(w, r) return } diff --git a/src/vendor/github.com/go-chi/chi/v5/path_value.go b/src/vendor/github.com/go-chi/chi/v5/path_value.go new file mode 100644 index 000000000..7e78171e5 --- /dev/null +++ b/src/vendor/github.com/go-chi/chi/v5/path_value.go @@ -0,0 +1,20 @@ +//go:build go1.22 +// +build go1.22 + +package chi + +import "net/http" + +// supportsPathValue is true if the Go version is 1.22 and above. +// +// If this is true, `net/http.Request` has methods `SetPathValue` and `PathValue`. +const supportsPathValue = true + +// setPathValue sets the path values in the Request value +// based on the provided request context. +func setPathValue(rctx *Context, r *http.Request) { + for i, key := range rctx.URLParams.Keys { + value := rctx.URLParams.Values[i] + r.SetPathValue(key, value) + } +} diff --git a/src/vendor/github.com/go-chi/chi/v5/path_value_fallback.go b/src/vendor/github.com/go-chi/chi/v5/path_value_fallback.go new file mode 100644 index 000000000..f551781a4 --- /dev/null +++ b/src/vendor/github.com/go-chi/chi/v5/path_value_fallback.go @@ -0,0 +1,19 @@ +//go:build !go1.22 +// +build !go1.22 + +package chi + +import "net/http" + +// supportsPathValue is true if the Go version is 1.22 and above. +// +// If this is true, `net/http.Request` has methods `SetPathValue` and `PathValue`. +const supportsPathValue = false + +// setPathValue sets the path values in the Request value +// based on the provided request context. +// +// setPathValue is only supported in Go 1.22 and above so +// this is just a blank function so that it compiles. +func setPathValue(rctx *Context, r *http.Request) { +} diff --git a/src/vendor/modules.txt b/src/vendor/modules.txt index 14cf6ccfe..0c60942a1 100644 --- a/src/vendor/modules.txt +++ b/src/vendor/modules.txt @@ -46,7 +46,7 @@ github.com/cloudfoundry/dropsonde/emitter # github.com/cloudfoundry/sonde-go v0.0.0-20230606195250-c7c0fdf1ccc4 ## explicit; go 1.17 github.com/cloudfoundry/sonde-go/events -# github.com/go-chi/chi/v5 v5.0.11 +# github.com/go-chi/chi/v5 v5.0.12 ## explicit; go 1.14 github.com/go-chi/chi/v5 # github.com/go-logr/logr v1.3.0