Documentation ¶
Index ¶
- Constants
- func Decorate(f APIHandler, ds ...Decorator) httprouter.Handle
- func LogMethodNotAllowedHandler() http.Handler
- func LogNotFoundHandler() http.Handler
- func LogPanicHandler() func(w http.ResponseWriter, req *http.Request, p interface{})
- func NewDeadlineTransport(connectTimeout time.Duration, requestTimeout time.Duration) *http.Transport
- func RespondV1(w http.ResponseWriter, code int, data interface{})
- type APIHandler
- type Decorator
- type Err
- type HttpClient
Constants ¶
View Source
const ( UserAgent = "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:54.0) Gecko/20100101 Firefox/54.0" HTTPBodyTypeJSON = "application/json" )
Variables ¶
This section is empty.
Functions ¶
func Decorate ¶
func Decorate(f APIHandler, ds ...Decorator) httprouter.Handle
func LogNotFoundHandler ¶
func LogPanicHandler ¶
func LogPanicHandler() func(w http.ResponseWriter, req *http.Request, p interface{})
func NewDeadlineTransport ¶
func NewDeadlineTransport(connectTimeout time.Duration, requestTimeout time.Duration) *http.Transport
A custom http.Transport with support for deadline timeouts
func RespondV1 ¶
func RespondV1(w http.ResponseWriter, code int, data interface{})
Types ¶
type APIHandler ¶
type APIHandler func(http.ResponseWriter, *http.Request, httprouter.Params) (interface{}, error)
func Log ¶
func Log(f APIHandler) APIHandler
func V1 ¶
func V1(f APIHandler) APIHandler
type Decorator ¶
type Decorator func(APIHandler) APIHandler
type HttpClient ¶
type HttpClient struct {
// contains filtered or unexported fields
}
func NewHttpClient ¶
func NewHttpClient(connectTimeout time.Duration, requestTimeout time.Duration) *HttpClient
func (*HttpClient) HTTPPostJSON ¶
Click to show internal directories.
Click to hide internal directories.