Skip to content

v0.12.0

Choose a tag to compare

@floatdrop floatdrop released this 06 Sep 16:16
· 9 commits to main since this release
529bff2

The request-scope middleware becomes a dependency a server's constructor can
take, so an application needs no Provide closure to serve HTTP. go doc -all against 0.11.0 leaves di untouched and changes dihttp: Middleware
is now the type, NewMiddleware makes one, Module registers one. The rename
is the breaking change, and the reason for the minor bump.

Changed

  • dihttp.Middleware is now the type, func(http.Handler) http.Handler, so
    a server's constructor can take one as a parameter; the function that
    makes one is dihttp.NewMiddleware. A call dihttp.Middleware(app) no
    longer compiles: rename it, or take the middleware as a dependency.

Added

  • dihttp.Module registers a Middleware over the scope it is applied to.
    With it the guide's server is a wired constructor with its dependencies
    declared, and the guide application uses no Provide closure at all.