Versions in this module Expand all Collapse all v1 v1.0.0 Aug 14, 2023 Changes in this version + const GzipEncoding + const HeaderAcceptEncoding + type Endpoint func(ctx context.Context, r *Request) (interface{}, error) + type HTTPError struct + Code string + Details []string + Message string + Status int + func BadRequest(msg string) *HTTPError + func Error(status int, code, message string) *HTTPError + func NotFound(msg string) *HTTPError + func Unauthorized(msg string) *HTTPError + func UnprocessableEntity(msg string) *HTTPError + func (err *HTTPError) Cause() error + func (err *HTTPError) Error() string + func (err *HTTPError) MarshalJSON() ([]byte, error) + func (err *HTTPError) StatusCode() int + func (err *HTTPError) Unwrap() error + func (err *HTTPError) Wrap(inner error) *HTTPError + type HTTPErrorResponse interface + StatusCode func() int + type M map[string]interface + type Middleware func(Endpoint) Endpoint + type Option func(*Router) + func WithCompressionEnabled(level int) Option + func WithDisableJSONIndent() Option + func WithNotFoundHandler(h http.Handler) Option + type Request struct + func NewTestRequest(params httprouter.Params, req *http.Request, route string) Request + func (r *Request) BasicAuth() (username, password string, ok bool) + func (r *Request) BindBody(val interface{}) error + func (r *Request) FormFile(name string, maxMultipartMemory int64) (multipart.File, *multipart.FileHeader, error) + func (r *Request) Get(key interface{}) interface{} + func (r *Request) Header(name string) string + func (r *Request) Method() string + func (r *Request) Param(name string) string + func (r *Request) Query(name string) string + func (r *Request) Raw() *http.Request + func (r *Request) Route() string + func (r *Request) Set(key, val interface{}) + func (r *Request) SetResponseHeader(key, val string) + func (r *Request) URL() *url.URL + type Response struct + Body interface{} + StatusCode int + type RouteMap map[string]Endpoint + type Router struct + DumpErrors bool + func NewRouter(options ...Option) *Router + func (r *Router) Get(path string, endpoint Endpoint) + func (r *Router) Group(groupOptions ...Option) *Router + func (r *Router) Handle(method, path string, endpoint Endpoint) + func (r *Router) Head(path string, endpoint Endpoint) + func (r *Router) Post(path string, endpoint Endpoint) + func (r *Router) Routes(m RouteMap) + func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request) + func (r *Router) Use(ms ...Middleware)