Documentation ¶
Index ¶
- func ConvertPhpQuery(u url.Values) map[string]any
- func EncodePhpQuery(q map[string]any) 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 HTTPStatus(err error) int
- func HttpErrorHandler(code int) http.Handler
- func HttpHandlerToError(h http.Handler) error
- func IsRedirect(e error) http.Handler
- func ParseDataUri(u string) ([]byte, string, error)
- func ParseIPPort(ip string) *net.TCPAddr
- func ParsePhpQuery(q string) map[string]any
- func RedirectError(u *url.URL) error
- func RedirectErrorCode(u *url.URL, code int) error
- func SendRedirect(w http.ResponseWriter, target string, code int)
- func ServeError(w http.ResponseWriter, req *http.Request, err error)
- func Wrap(h Handler) http.Handler
- type Handler
- type HttpError
- type Redirect
- type WrapFunc
- type Wrapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 HTTPStatus ¶ added in v0.0.5
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]any
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, target string, code int)
SendRedirect is deprecated. http.Redirect() should be used instead
func ServeError ¶
func ServeError(w http.ResponseWriter, req *http.Request, err error)
Types ¶
type Handler ¶ added in v0.0.8
type Handler interface {
ServeHTTP(w http.ResponseWriter, req *http.Request) error
}
type HttpError ¶
type HttpError int
func (HttpError) HTTPStatus ¶ added in v0.0.5
HTTPStatus returns the value set in http error