Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPServer ¶
type HTTPServer struct {
// contains filtered or unexported fields
}
HTTPServer allows using middlewares with http.Server and allow controlling server lifecycle using context.
func New ¶
func New(ctx context.Context, srv *http.Server) *HTTPServer
New creates a new HTTPServer instance.
func (*HTTPServer) Addr ¶
func (s *HTTPServer) Addr() net.Addr
Addr returns the server's network address.
func (*HTTPServer) ServeHTTP ¶
func (s *HTTPServer) ServeHTTP(rw http.ResponseWriter, r *http.Request)
ServeHTTP prepares middlewares stack if necessary and calls ServerHTTP on the wrapped server.
func (*HTTPServer) Use ¶
func (s *HTTPServer) Use(m ...Middleware)
Use adds a middleware. Middlewares will be called in the order in which they were added. This function will panic after calling ServerHTTP/Start.
func (*HTTPServer) Wait ¶
func (s *HTTPServer) Wait() chan error
Wait waits until the context is canceled or until an error occurs.
Click to show internal directories.
Click to hide internal directories.