Documentation ¶
Overview ¶
Package httplib implements common utility functions for writing classic HTTP handlers
Index ¶
- func ConvertResponse(re *roundtrip.Response, err error) (*roundtrip.Response, error)
- func InsecureSetDevmodeHeaders(w http.ResponseWriter)
- func MakeHandler(fn HandlerFunc) httprouter.Handle
- func MakeStdHandler(fn StdHandlerFunc) http.HandlerFunc
- func ParseBool(q url.Values, name string) (bool, bool, error)
- func ReadJSON(r *http.Request, val interface{}) error
- type HandlerFunc
- type StdHandlerFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertResponse ¶
ConvertResponse converts http error to internal error type based on HTTP response code and HTTP body contents
func InsecureSetDevmodeHeaders ¶
func InsecureSetDevmodeHeaders(w http.ResponseWriter)
InsecureSetDevmodeHeaders allows cross-origin requests, used in dev mode only
func MakeHandler ¶
func MakeHandler(fn HandlerFunc) httprouter.Handle
MakeHandler returns a new httprouter.Handle func from a handler func
func MakeStdHandler ¶
func MakeStdHandler(fn StdHandlerFunc) http.HandlerFunc
MakeStdHandler returns a new http.Handle func from http.HandlerFunc
Types ¶
type HandlerFunc ¶
type HandlerFunc func(w http.ResponseWriter, r *http.Request, p httprouter.Params) (interface{}, error)
HandlerFunc specifies HTTP handler function that returns error
type StdHandlerFunc ¶
type StdHandlerFunc func(w http.ResponseWriter, r *http.Request) (interface{}, error)
StdHandlerFunc specifies HTTP handler function that returns error
Click to show internal directories.
Click to hide internal directories.