Documentation ¶
Index ¶
- Constants
- type CORS
- type Config
- func (c *Config) IsContainMiddlewares() bool
- func (c *Config) Middlewares() []func(http.Handler) http.Handler
- func (c *Config) Port() int
- func (c *Config) PrivateHandlers() []*RequestHandler
- func (c *Config) PublicHandlers() []*RequestHandler
- func (c *Config) RegisterMiddleware(middleware func(http.Handler) http.Handler)
- func (c *Config) RegisterPrivateHandler(method, route string, handlerFn http.HandlerFunc)
- func (c *Config) RegisterPublicHandler(method, route string, handlerFn http.HandlerFunc)
- type ErrorResponse
- type ErrorResponseData
- type RequestHandler
Constants ¶
View Source
const ( RequestIDHeaderName = "X-Request-ID" HeaderContentType = "Content-Type" HeaderContentLength = "Content-Length" HeaderXContentTypeOptions = "X-Content-Type-Options" )
View Source
const ( ReadyURL = "/readyz" HealthURL = "/healthz" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CORS ¶
type CORS struct {
// contains filtered or unexported fields
}
func (*CORS) AllowedHeaders ¶
func (*CORS) AllowedOrigins ¶
type Config ¶
type Config struct { ReadTimeout int WriteTimeout int IdleTimeOut int ShutdownTimeout int CORS *CORS // contains filtered or unexported fields }
func NewDefaultConfig ¶
func (*Config) IsContainMiddlewares ¶
func (*Config) PrivateHandlers ¶
func (c *Config) PrivateHandlers() []*RequestHandler
func (*Config) PublicHandlers ¶
func (c *Config) PublicHandlers() []*RequestHandler
func (*Config) RegisterMiddleware ¶
func (*Config) RegisterPrivateHandler ¶
func (c *Config) RegisterPrivateHandler(method, route string, handlerFn http.HandlerFunc)
func (*Config) RegisterPublicHandler ¶
func (c *Config) RegisterPublicHandler(method, route string, handlerFn http.HandlerFunc)
type ErrorResponse ¶
type ErrorResponse struct {
Errors []ErrorResponseData `json:"errors"`
}
func NewErrorResponse ¶
func NewErrorResponse(errorsData []ErrorResponseData) ErrorResponse
func NewSingleErrorResponse ¶
func NewSingleErrorResponse(errorData ErrorResponseData) ErrorResponse
func (ErrorResponse) FirstHttpCode ¶
func (r ErrorResponse) FirstHttpCode() int
type ErrorResponseData ¶
type RequestHandler ¶
type RequestHandler struct {
// contains filtered or unexported fields
}
func (*RequestHandler) HandlerFunc ¶
func (h *RequestHandler) HandlerFunc() http.HandlerFunc
func (*RequestHandler) Method ¶
func (h *RequestHandler) Method() string
func (*RequestHandler) Route ¶
func (h *RequestHandler) Route() string
Click to show internal directories.
Click to hide internal directories.