allow to have custom http.Server struct

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2021-02-07 19:03:38 +03:00
parent dc1e05bb18
commit c0d9c34200
2 changed files with 17 additions and 1 deletions

View File

@@ -33,3 +33,9 @@ type middlewareKey struct{}
func Middleware(mw ...func(http.Handler) http.Handler) server.Option {
return server.SetOption(middlewareKey{}, mw)
}
type serverKey struct{}
func Server(hs *http.Server) server.Option {
return server.SetOption(serverKey{}, hs)
}