Documentation ¶
Index ¶
- func ConvertPhpQuery(u url.Values) map[string]interface{}
- func CtxPrintf(ctx context.Context, format string, v ...interface{})
- func CtxSetPrefix(ctx context.Context, prefix string)
- func EncodePhpQuery(q map[string]interface{}) string
- func ErrorHandler(f http.Handler) error
- func ErrorHandlerFunc(f func(w http.ResponseWriter, req *http.Request)) error
- func ErrorToHttpHandler(e error) http.Handler
- func HttpErrorHandler(code int) http.Handler
- func HttpHandlerToError(h http.Handler) error
- func IsRedirect(e error) http.Handler
- func NewContextLogger(ctx context.Context, l *log.Logger) context.Context
- func ParseDataUri(u string) ([]byte, string, error)
- func ParseIPPort(ip string) *net.TCPAddr
- func ParsePhpQuery(q string) map[string]interface{}
- func RedirectError(u *url.URL) error
- func RedirectErrorCode(u *url.URL, code int) error
- func SendRedirect(w http.ResponseWriter, url string, code int)
- func ServeError(w http.ResponseWriter, req *http.Request, err error)
- type HttpError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertPhpQuery ¶
func CtxSetPrefix ¶
func EncodePhpQuery ¶
func ErrorHandler ¶ added in v0.0.2
ErrorHandler returns an error that also complies with http.Handler for a given http.Handler.
func ErrorHandlerFunc ¶ added in v0.0.2
func ErrorHandlerFunc(f func(w http.ResponseWriter, req *http.Request)) error
ErrorHandlerFunc returns an error that also complies with http.Handler for a given function.
func ErrorToHttpHandler ¶
func HttpErrorHandler ¶
func HttpHandlerToError ¶
func IsRedirect ¶
func ParseDataUri ¶
ParseDataUri will parse a given data: uri and return its data and mime type.
func ParseIPPort ¶
ParseIPPort will parse an IP with optionally a port
func ParsePhpQuery ¶
ParsePhpQuery parses PHP compatible query string, return as map[string]interface{}
multiple cases may happen: a=b (simple) a[b]=c (object) a[]=c (array) a[b][]=c (multi levels) a[][][]=c (wtf)
func RedirectError ¶
func RedirectErrorCode ¶
code can be one of http.StatusMovedPermanently or http.StatusFound or any 3xx http status code
func SendRedirect ¶
func SendRedirect(w http.ResponseWriter, url string, code int)
func ServeError ¶
func ServeError(w http.ResponseWriter, req *http.Request, err error)
Types ¶
Click to show internal directories.
Click to hide internal directories.