From ac239f4fac47627bcb45392f37bd0c510923a9dd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 11 Oct 2023 15:59:07 +0000 Subject: [PATCH] Bump github.com/pivotal-cf/brokerapi/v10 from 10.0.0 to 10.1.0 (#238) Bumps [github.com/pivotal-cf/brokerapi/v10](https://github.com/pivotal-cf/brokerapi) from 10.0.0 to 10.1.0. - [Release notes](https://github.com/pivotal-cf/brokerapi/releases) - [Commits](https://github.com/pivotal-cf/brokerapi/compare/v10.0.0...v10.1.0) --- updated-dependencies: - dependency-name: github.com/pivotal-cf/brokerapi/v10 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 4 +-- go.sum | 8 +++--- vendor/github.com/go-chi/chi/v5/CHANGELOG.md | 17 +++++++++--- vendor/github.com/go-chi/chi/v5/README.md | 2 +- vendor/github.com/go-chi/chi/v5/context.go | 1 + vendor/github.com/go-chi/chi/v5/mux.go | 22 ++++++++++------ vendor/github.com/go-chi/chi/v5/tree.go | 26 +++++++++++++++++++ .../pivotal-cf/brokerapi/v10/api.go | 4 +-- .../pivotal-cf/brokerapi/v10/api_options.go | 4 +-- .../domain/apiresponses/failure_responses.go | 4 +-- .../brokerapi/v10/failure_response.go | 6 ++--- vendor/modules.txt | 6 ++--- 12 files changed, 74 insertions(+), 30 deletions(-) diff --git a/go.mod b/go.mod index ee4e5925c..cdeb74dfe 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/onsi/ginkgo/v2 v2.13.0 github.com/onsi/gomega v1.28.0 github.com/pborman/uuid v1.2.1 - github.com/pivotal-cf/brokerapi/v10 v10.0.0 + github.com/pivotal-cf/brokerapi/v10 v10.1.0 github.com/pivotal-cf/on-demand-services-sdk v0.44.1-0.20231010130102-2c9e4cc61409 github.com/pkg/errors v0.9.1 github.com/urfave/negroni v1.0.0 @@ -33,7 +33,7 @@ require ( github.com/cloudfoundry/socks5-proxy v0.2.100 // indirect github.com/cppforlife/go-semi-semantic v0.0.0-20160921010311-576b6af77ae4 // indirect github.com/gabriel-vasile/mimetype v1.4.2 // indirect - github.com/go-chi/chi/v5 v5.0.8 // indirect + github.com/go-chi/chi/v5 v5.0.10 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect diff --git a/go.sum b/go.sum index 0ca2463de..b12166e51 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4 github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= -github.com/go-chi/chi/v5 v5.0.8 h1:lD+NLqFcAi1ovnVZpsnObHGW4xb4J8lNmoYVfECH1Y0= -github.com/go-chi/chi/v5 v5.0.8/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= +github.com/go-chi/chi/v5 v5.0.10 h1:rLz5avzKpjqxrYwXNfmjkrYYXOyLJd37pz53UFHC6vk= +github.com/go-chi/chi/v5 v5.0.10/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= @@ -117,8 +117,8 @@ github.com/openzipkin/zipkin-go v0.4.1 h1:kNd/ST2yLLWhaWrkgchya40TJabe8Hioj9udfP github.com/openzipkin/zipkin-go v0.4.1/go.mod h1:qY0VqDSN1pOBN94dBc6w2GJlWLiovAyg7Qt6/I9HecM= github.com/pborman/uuid v1.2.1 h1:+ZZIw58t/ozdjRaXh/3awHfmWRbzYxJoAdNJxe/3pvw= github.com/pborman/uuid v1.2.1/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= -github.com/pivotal-cf/brokerapi/v10 v10.0.0 h1:cC2zdIF1jh1twD196xWpHjiX2JEbU+RMLH2jpmLDRT8= -github.com/pivotal-cf/brokerapi/v10 v10.0.0/go.mod h1:LVexXnzj0Zj7lxIJXnDqc794/XHwEzkOPzAZdEaKM5M= +github.com/pivotal-cf/brokerapi/v10 v10.1.0 h1:1sMJ88XPIU1nKSF29SkxEglDdgLg4buY9/tryp96haU= +github.com/pivotal-cf/brokerapi/v10 v10.1.0/go.mod h1:ctJc3q3zLhIt+OmQMi7LGNsWkP4xi2HRPKXwYe98Mnk= github.com/pivotal-cf/on-demand-services-sdk v0.44.1-0.20231010130102-2c9e4cc61409 h1:wCfeAvXaiJJjjm2x8uidGF0A3Sni5edS2Boxb3V5HZI= github.com/pivotal-cf/on-demand-services-sdk v0.44.1-0.20231010130102-2c9e4cc61409/go.mod h1:K0eHDML2ECrE/tscKXdp39V22AfFTlAHVFO3rvRU8TE= github.com/pivotal-cf/paraphernalia v0.0.0-20180203224945-a64ae2051c20 h1:DR5eMfe2+6GzLkVyWytdtgUxgbPiOfvKDuqityTV3y8= diff --git a/vendor/github.com/go-chi/chi/v5/CHANGELOG.md b/vendor/github.com/go-chi/chi/v5/CHANGELOG.md index a1feeec05..f6eb7e6e4 100644 --- a/vendor/github.com/go-chi/chi/v5/CHANGELOG.md +++ b/vendor/github.com/go-chi/chi/v5/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## v5.0.10 (2023-07-13) + +- Fixed small edge case in tests of v5.0.9 for older Go versions +- History of changes: see https://github.com/go-chi/chi/compare/v5.0.8...v5.0.10 + + +## v5.0.9 (2023-07-13) + +- History of changes: see https://github.com/go-chi/chi/compare/v5.0.8...v5.0.9 + + ## v5.0.8 (2022-12-07) - History of changes: see https://github.com/go-chi/chi/compare/v5.0.7...v5.0.8 @@ -90,14 +101,14 @@ incremental, with the architecture and api being the same today as it was origin makes chi a pretty easy project to maintain, as well thanks to the many amazing community contributions over the years to who all help make chi better (total of 86 contributors to date -- thanks all!). -Chi has been an labour of love, art and engineering, with the goals to offer beautiful ergonomics, flexibility, performance +Chi has been a labour of love, art and engineering, with the goals to offer beautiful ergonomics, flexibility, performance and simplicity when building HTTP services with Go. I've strived to keep the router very minimal in surface area / code size, and always improving the code wherever possible -- and as of today the `chi` package is just 1082 lines of code (not counting middlewares, which are all optional). As well, I don't have the exact metrics, but from my analysis and email exchanges from companies and developers, chi is used by thousands of projects around the world -- thank you all as there is no better form of joy for me than to have art I had started be helpful and enjoyed by others. And of course I use chi in all of my own projects too :) -For me, the asthetics of chi's code and usage are very important. With the introduction of Go's module support +For me, the aesthetics of chi's code and usage are very important. With the introduction of Go's module support (which I'm a big fan of), chi's past versioning scheme choice to v2, v3 and v4 would mean I'd require the import path of "github.com/go-chi/chi/v4", leading to the lengthy discussion at https://github.com/go-chi/chi/issues/462. Haha, to some, you may be scratching your head why I've spent > 1 year stalling to adopt "/vXX" convention in the import @@ -289,7 +300,7 @@ Cheers all, happy coding! ## v2.0.0-rc1 (2016-07-26) -- Huge update! chi v2 is a large refactor targetting Go 1.7+. As of Go 1.7, the popular +- Huge update! chi v2 is a large refactor targeting Go 1.7+. As of Go 1.7, the popular community `"net/context"` package has been included in the standard library as `"context"` and utilized by `"net/http"` and `http.Request` to managing deadlines, cancelation signals and other request-scoped values. We're very excited about the new context addition and are proud to diff --git a/vendor/github.com/go-chi/chi/v5/README.md b/vendor/github.com/go-chi/chi/v5/README.md index 3e4cc4a2e..718e373fa 100644 --- a/vendor/github.com/go-chi/chi/v5/README.md +++ b/vendor/github.com/go-chi/chi/v5/README.md @@ -1,7 +1,7 @@ # chi -[![GoDoc Widget]][GoDoc] [![Travis Widget]][Travis] +[![GoDoc Widget]][GoDoc] `chi` is a lightweight, idiomatic and composable router for building Go HTTP services. It's especially good at helping you write large REST API services that are kept maintainable as your diff --git a/vendor/github.com/go-chi/chi/v5/context.go b/vendor/github.com/go-chi/chi/v5/context.go index e78a2385d..88f8e221a 100644 --- a/vendor/github.com/go-chi/chi/v5/context.go +++ b/vendor/github.com/go-chi/chi/v5/context.go @@ -76,6 +76,7 @@ type Context struct { // methodNotAllowed hint methodNotAllowed bool + methodsAllowed []methodTyp // allowed methods in case of a 405 } // Reset a routing context to its initial state. diff --git a/vendor/github.com/go-chi/chi/v5/mux.go b/vendor/github.com/go-chi/chi/v5/mux.go index 47e64cf29..977aa52dd 100644 --- a/vendor/github.com/go-chi/chi/v5/mux.go +++ b/vendor/github.com/go-chi/chi/v5/mux.go @@ -156,7 +156,7 @@ func (mx *Mux) Head(pattern string, handlerFn http.HandlerFunc) { mx.handle(mHEAD, pattern, handlerFn) } -// Options adds the route `pattern` that matches a OPTIONS http method to +// Options adds the route `pattern` that matches an OPTIONS http method to // execute the `handlerFn` http.HandlerFunc. func (mx *Mux) Options(pattern string, handlerFn http.HandlerFunc) { mx.handle(mOPTIONS, pattern, handlerFn) @@ -378,11 +378,11 @@ func (mx *Mux) NotFoundHandler() http.HandlerFunc { // MethodNotAllowedHandler returns the default Mux 405 responder whenever // a method cannot be resolved for a route. -func (mx *Mux) MethodNotAllowedHandler() http.HandlerFunc { +func (mx *Mux) MethodNotAllowedHandler(methodsAllowed ...methodTyp) http.HandlerFunc { if mx.methodNotAllowedHandler != nil { return mx.methodNotAllowedHandler } - return methodNotAllowedHandler + return methodNotAllowedHandler(methodsAllowed...) } // handle registers a http.Handler in the routing tree for a particular http method @@ -445,7 +445,7 @@ func (mx *Mux) routeHTTP(w http.ResponseWriter, r *http.Request) { return } if rctx.methodNotAllowed { - mx.MethodNotAllowedHandler().ServeHTTP(w, r) + mx.MethodNotAllowedHandler(rctx.methodsAllowed...).ServeHTTP(w, r) } else { mx.NotFoundHandler().ServeHTTP(w, r) } @@ -480,8 +480,14 @@ func (mx *Mux) updateRouteHandler() { } // methodNotAllowedHandler is a helper function to respond with a 405, -// method not allowed. -func methodNotAllowedHandler(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(405) - w.Write(nil) +// method not allowed. It sets the Allow header with the list of allowed +// methods for the route. +func methodNotAllowedHandler(methodsAllowed ...methodTyp) func(w http.ResponseWriter, r *http.Request) { + return func(w http.ResponseWriter, r *http.Request) { + for _, m := range methodsAllowed { + w.Header().Add("Allow", reverseMethodMap[m]) + } + w.WriteHeader(405) + w.Write(nil) + } } diff --git a/vendor/github.com/go-chi/chi/v5/tree.go b/vendor/github.com/go-chi/chi/v5/tree.go index 4189b5228..c7d3bc570 100644 --- a/vendor/github.com/go-chi/chi/v5/tree.go +++ b/vendor/github.com/go-chi/chi/v5/tree.go @@ -43,6 +43,18 @@ var methodMap = map[string]methodTyp{ http.MethodTrace: mTRACE, } +var reverseMethodMap = map[methodTyp]string{ + mCONNECT: http.MethodConnect, + mDELETE: http.MethodDelete, + mGET: http.MethodGet, + mHEAD: http.MethodHead, + mOPTIONS: http.MethodOptions, + mPATCH: http.MethodPatch, + mPOST: http.MethodPost, + mPUT: http.MethodPut, + mTRACE: http.MethodTrace, +} + // RegisterMethod adds support for custom HTTP method handlers, available // via Router#Method and Router#MethodFunc func RegisterMethod(method string) { @@ -454,6 +466,13 @@ func (n *node) findRoute(rctx *Context, method methodTyp, path string) *node { return xn } + for endpoints := range xn.endpoints { + if endpoints == mALL || endpoints == mSTUB { + continue + } + rctx.methodsAllowed = append(rctx.methodsAllowed, endpoints) + } + // flag that the routing context found a route, but not a corresponding // supported method rctx.methodNotAllowed = true @@ -493,6 +512,13 @@ func (n *node) findRoute(rctx *Context, method methodTyp, path string) *node { return xn } + for endpoints := range xn.endpoints { + if endpoints == mALL || endpoints == mSTUB { + continue + } + rctx.methodsAllowed = append(rctx.methodsAllowed, endpoints) + } + // flag that the routing context found a route, but not a corresponding // supported method rctx.methodNotAllowed = true diff --git a/vendor/github.com/pivotal-cf/brokerapi/v10/api.go b/vendor/github.com/pivotal-cf/brokerapi/v10/api.go index 4aeee2b17..0fbb095fa 100644 --- a/vendor/github.com/pivotal-cf/brokerapi/v10/api.go +++ b/vendor/github.com/pivotal-cf/brokerapi/v10/api.go @@ -36,11 +36,11 @@ func NewWithCustomAuth(serviceBroker ServiceBroker, logger lager.Logger, authMid return NewWithOptions(serviceBroker, logger, WithCustomAuth(authMiddleware)) } -func AttachRoutes(router *chi.Mux, serviceBroker ServiceBroker, logger lager.Logger) { +func AttachRoutes(router chi.Router, serviceBroker ServiceBroker, logger lager.Logger) { attachRoutes(router, serviceBroker, logger) } -func attachRoutes(router *chi.Mux, serviceBroker ServiceBroker, logger lager.Logger) { +func attachRoutes(router chi.Router, serviceBroker ServiceBroker, logger lager.Logger) { apiHandler := handlers.NewApiHandler(serviceBroker, logger) router.Get("/v2/catalog", apiHandler.Catalog) diff --git a/vendor/github.com/pivotal-cf/brokerapi/v10/api_options.go b/vendor/github.com/pivotal-cf/brokerapi/v10/api_options.go index e691191e7..488b24173 100644 --- a/vendor/github.com/pivotal-cf/brokerapi/v10/api_options.go +++ b/vendor/github.com/pivotal-cf/brokerapi/v10/api_options.go @@ -37,7 +37,7 @@ func NewWithOptions(serviceBroker domain.ServiceBroker, logger lager.Logger, opt type Option func(*config) -func WithRouter(router *chi.Mux) Option { +func WithRouter(router chi.Router) Option { return func(c *config) { c.router = router c.customRouter = true @@ -96,7 +96,7 @@ func newDefaultConfig(logger lager.Logger) *config { } type config struct { - router *chi.Mux + router chi.Router customRouter bool logger lager.Logger } diff --git a/vendor/github.com/pivotal-cf/brokerapi/v10/domain/apiresponses/failure_responses.go b/vendor/github.com/pivotal-cf/brokerapi/v10/domain/apiresponses/failure_responses.go index 436d43b47..cce328396 100644 --- a/vendor/github.com/pivotal-cf/brokerapi/v10/domain/apiresponses/failure_responses.go +++ b/vendor/github.com/pivotal-cf/brokerapi/v10/domain/apiresponses/failure_responses.go @@ -18,11 +18,11 @@ type FailureResponse struct { errorKey string } -// NewFailureResponse returns a pointer to a new instance of FailureResponse. +// NewFailureResponse returns an error of type FailureResponse. // err will by default be used as both a logging message and HTTP response description. // statusCode is the HTTP status code to be returned, must be 4xx or 5xx // loggerAction is a short description which will be used as the action if the error is logged. -func NewFailureResponse(err error, statusCode int, loggerAction string) *FailureResponse { +func NewFailureResponse(err error, statusCode int, loggerAction string) error { return &FailureResponse{ error: err, statusCode: statusCode, diff --git a/vendor/github.com/pivotal-cf/brokerapi/v10/failure_response.go b/vendor/github.com/pivotal-cf/brokerapi/v10/failure_response.go index b2dd463c8..11bcb6000 100644 --- a/vendor/github.com/pivotal-cf/brokerapi/v10/failure_response.go +++ b/vendor/github.com/pivotal-cf/brokerapi/v10/failure_response.go @@ -17,12 +17,12 @@ import ( type FailureResponse = apiresponses.FailureResponse // Deprecated: Use github.com/pivotal-cf/brokerapi/domain/apiresponses -// NewFailureResponse returns a pointer to a new instance of FailureResponse. +// NewFailureResponse returns an error of type FailureResponse. // err will by default be used as both a logging message and HTTP response description. // statusCode is the HTTP status code to be returned, must be 4xx or 5xx // loggerAction is a short description which will be used as the action if the error is logged. -func NewFailureResponse(err error, statusCode int, loggerAction string) *FailureResponse { - return (*FailureResponse)(apiresponses.NewFailureResponse(err, statusCode, loggerAction)) +func NewFailureResponse(err error, statusCode int, loggerAction string) error { + return apiresponses.NewFailureResponse(err, statusCode, loggerAction) } // Deprecated: Use github.com/pivotal-cf/brokerapi/domain/apiresponses diff --git a/vendor/modules.txt b/vendor/modules.txt index 14fce4cf3..fda00f473 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -63,7 +63,7 @@ github.com/gabriel-vasile/mimetype github.com/gabriel-vasile/mimetype/internal/charset github.com/gabriel-vasile/mimetype/internal/json github.com/gabriel-vasile/mimetype/internal/magic -# github.com/go-chi/chi/v5 v5.0.8 +# github.com/go-chi/chi/v5 v5.0.10 ## explicit; go 1.14 github.com/go-chi/chi/v5 # github.com/go-logr/logr v1.2.4 @@ -164,8 +164,8 @@ github.com/openzipkin/zipkin-go/model # github.com/pborman/uuid v1.2.1 ## explicit github.com/pborman/uuid -# github.com/pivotal-cf/brokerapi/v10 v10.0.0 -## explicit; go 1.19 +# github.com/pivotal-cf/brokerapi/v10 v10.1.0 +## explicit; go 1.20 github.com/pivotal-cf/brokerapi/v10 github.com/pivotal-cf/brokerapi/v10/auth github.com/pivotal-cf/brokerapi/v10/domain