-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!: remove dependency on go-chi/chi #340
Conversation
8413428
to
519c799
Compare
BREAKING CHANGE In Go 1.22, http.ServeMux was improved so that we no longer need to use go-chi/chi, gorilla/mux, or any other thrid party HTTP router. The advantage to consumers is that they can use any router, or none, and do not have a dependency forced on them. Public API changes: - `New()` has changed signature to optionally take options. - `AttachRoutes()` has been removed. If you want to attach to an existing Chi router, you can still do something like: ```go b := brokerapi.New(broker, logger, brokerapi.WithBrokerCredentials(creds)) r := chi.NewRouter() r.Handle("/*", b) ``` - The `WithRouter()` option has been removed as a Chi router can no longer be specified. - `WithEncodedPath()` has been removed as it was deprecated and did nothing.
|
||
fakeResponseWriter = new(fakes.FakeResponseWriter) | ||
fakeResponseWriter.HeaderReturns(http.Header{}) | ||
fakeServer = httptest.NewServer(brokerapi.NewWithOptions(fakeServiceBroker, slog.New(slog.NewJSONHandler(GinkgoWriter, nil)))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
praise: nice to see the Standard library solution for HTTP tests
var cfg config | ||
WithOptions(opts...)(&cfg) | ||
|
||
mw := append(append(cfg.authMiddleware, defaultMiddleware(logger)...), cfg.additionalMiddleware...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: I think we have to change this order, what do you think?
mw := append(append(cfg.additionalMiddleware, defaultMiddleware(logger)...), cfg.authMiddleware...)
One more question before merging, @blgm I hope I am not confusing you. |
There's mw := append(append(cfg.authMiddleware, defaultMiddleware(logger)...), cfg.additionalMiddleware...) So the first auth middleware is applied first, then any additional auth middlewares in the order that they were added, then the default middleware, then any additional middlwares in the order that they were added. |
BREAKING CHANGE
In Go 1.22, http.ServeMux was improved so that we no longer need to use
go-chi/chi, gorilla/mux, or any other thrid party HTTP router. The advantage to consumers
is that they can use any router, or none, and do not have a dependency forced on them.
Public API changes:
New()
has changed signature to optionally take options.AttachRoutes()
has been removed. If you want to attach to an existing Chi router, you can stilldo something like:
The
WithRouter()
option has been removed as a Chi router can no longer be specified.WithEncodedPath()
has been removed as it was deprecated and did nothing.