Documentation ¶
Index ¶
- func Adapt(h http.Handler, adapters ...Adapter) http.Handler
- func AdaptHTTPWithHeader(w http.ResponseWriter, header constants.Header) http.ResponseWriter
- func AdaptHTTPWithStatus(w http.ResponseWriter, header int) http.ResponseWriter
- func AdaptLimiter(lim *rate.Limiter, f func(w http.ResponseWriter, r *http.Request)) func(w http.ResponseWriter, r *http.Request)
- func AdaptRouterToDebugMode(router *mux.Router) *mux.Router
- func AdaptStatsHits(f func(w http.ResponseWriter, r *http.Request)) func(w http.ResponseWriter, r *http.Request)
- func AdaptStatsRouteHits(route string, f func(w http.ResponseWriter, r *http.Request)) func(w http.ResponseWriter, r *http.Request)
- func GetLocalIP() string
- func GetPort() int32
- func Map(m interface{}) map[string]interface{}
- func MapToExposureAddress(in string) string
- func RandStringBytesMaskImprSrc(n int) string
- func ReflectFuncName(fun interface{}) string
- func SortArrayInt(origin []int)
- func SortArrayIntReverse(origin []int)
- func StripRouteToAPIRoute(rt string) string
- func StripRouteToFunctName(rt string) string
- type Adapter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AdaptHTTPWithHeader ¶
func AdaptHTTPWithHeader(w http.ResponseWriter, header constants.Header) http.ResponseWriter
func AdaptHTTPWithStatus ¶
func AdaptHTTPWithStatus(w http.ResponseWriter, header int) http.ResponseWriter
make sure AdaptHTTPWithStatus is lastly added to the response writer, otherwise it would not work (ref: https://golang.org/pkg/net/http/#ResponseWriter)
func AdaptLimiter ¶
func AdaptLimiter(lim *rate.Limiter, f func(w http.ResponseWriter, r *http.Request)) func(w http.ResponseWriter, r *http.Request)
AdaptLimiter adapts the HTTP handler f to a limited handler that allows events up to rate lr and permits bursts of at most lb tokens.
func AdaptStatsHits ¶
func AdaptStatsHits(f func(w http.ResponseWriter, r *http.Request)) func(w http.ResponseWriter, r *http.Request)
func AdaptStatsRouteHits ¶
func AdaptStatsRouteHits(route string, f func(w http.ResponseWriter, r *http.Request)) func(w http.ResponseWriter, r *http.Request)
func GetLocalIP ¶
func GetLocalIP() string
func MapToExposureAddress ¶
func ReflectFuncName ¶
func ReflectFuncName(fun interface{}) string
func SortArrayInt ¶
func SortArrayInt(origin []int)
func SortArrayIntReverse ¶
func SortArrayIntReverse(origin []int)
func StripRouteToAPIRoute ¶
func StripRouteToFunctName ¶
Types ¶
type Adapter ¶
func RecoverHandler ¶
func RecoverHandler() Adapter
func SupportXHTTPMethodOverride ¶
func SupportXHTTPMethodOverride() Adapter
Override method by checking its header One thing you can do is to "tunnel" HTTP Methods inside another HTTP Header. Basically you have a header that says "No, seriously, I know I got here via a POST, but use this one instead." You would still POST, but then you'd have "X-HTTP-Method-Override:PUT" as a header.
func WithHeader ¶
Click to show internal directories.
Click to hide internal directories.