Documentation
¶
Overview ¶
Package http implements helpers for HTTP requests.
Index ¶
Constants ¶
View Source
const JSONContentType = "application/json"
JSONContentType represents MIME type for JSON content.
Variables ¶
View Source
var DefaultHealthPath = "/health"
DefaultHealthPath is the default HTTP path for checking health.
Functions ¶
func JSON ¶
func JSON(w http.ResponseWriter, code int, v interface{}) error
JSON encodes json content to the ResponseWriter.
func NewHealthHandler ¶
func NewHealthHandler(v ...Health) http.HandlerFunc
NewHealthHandler returns a handler for application health checking.
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 WithTLSConfig ¶
func WithTLSConfig(cfg *tls.Config) SrvOptFunc
WithTLSConfig sets the serve tls config.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package middleware implements reusable HTTP middleware.
|
Package middleware implements reusable HTTP middleware. |
Click to show internal directories.
Click to hide internal directories.