Documentation
¶
Overview ¶
Package http implements helpers for HTTP requests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultHealthPath = "/health"
DefaultHealthPath is the default HTTP path for checking health.
Functions ¶
func NewHealthHandler ¶
func NewHealthHandler(v ...Health) http.HandlerFunc
NewHealthHandler returns a handler for application health checking.
func OK ¶ added in v2.3.0
func OK(rw http.ResponseWriter, _ *http.Request)
OK replies to the request with an HTTP 200 ok reply.
Types ¶
type Health ¶
type Health interface {
IsHealthy() error
}
Health represents an object that can check its health.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a convenience wrapper around the standard library HTTP server.
type SrvOptFunc ¶
SrvOptFunc represents a server option function.
func WithH2C ¶ added in v2.2.0
func WithH2C() SrvOptFunc
WithH2C allows the server to handle h2c connections.
func WithReadTimeout ¶ added in v2.2.2
func WithReadTimeout(d time.Duration) SrvOptFunc
WithReadTimeout sets the server read timeout.
func WithTLSConfig ¶
func WithTLSConfig(cfg *tls.Config) SrvOptFunc
WithTLSConfig sets the serve tls config.
func WithWriteTimeout ¶ added in v2.2.2
func WithWriteTimeout(d time.Duration) SrvOptFunc
WithWriteTimeout sets the server write timeout.
Directories
¶
Path | Synopsis |
---|---|
Package middleware provides reusable HTTP middleware.
|
Package middleware provides reusable HTTP middleware. |
Package render provides HTTP output rendering helper functions.
|
Package render provides HTTP output rendering helper functions. |
Package request provides functions add and extract information from an http request.
|
Package request provides functions add and extract information from an http request. |
Click to show internal directories.
Click to hide internal directories.