Documentation ¶
Index ¶
- func Get(uri string) ([]byte, error)
- func GetBestRemoteAddress(r *http.Request) string
- func GetRequestInfo(r *http.Request, m map[string]interface{}, key string)
- func GetToFile(uri string, f *os.File) error
- func JoinURL(s1, s2 string) string
- func MakeFullRedirectURL(path string, reqURL *url.URL) string
- func NewDefaultTimeoutClient() *http.Client
- func NewTimeoutClient(connectTimeout time.Duration, readWriteTimeout time.Duration) *http.Client
- func Post(uri string, body []byte) ([]byte, error)
- func PostMultiPart(uri string, files map[string]string) ([]byte, error)
- func SimpleServer(opts SimpleServerOptions) error
- func SmartPermanentRedirect(w http.ResponseWriter, r *http.Request, uri string)
- func SmartRedirect(w http.ResponseWriter, r *http.Request, uri string, code int)
- func TryServeFileFromFS(w http.ResponseWriter, r *http.Request, opts *ServeFileOptions, fsPath string) bool
- func TryServeURLFromFS(w http.ResponseWriter, r *http.Request, opts *ServeFileOptions) bool
- type ServeFileOptions
- type SimpleServerOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBestRemoteAddress ¶
GetRequestIPAddress returns IP address of the request even for proxied requests
func NewDefaultTimeoutClient ¶
func NewTimeoutClient ¶
can be used for http.Get() requests with better timeouts. New one must be created for each Get() request
func SimpleServer ¶
func SimpleServer(opts SimpleServerOptions) error
run HTTP server serving a given directory
func SmartPermanentRedirect ¶
func SmartPermanentRedirect(w http.ResponseWriter, r *http.Request, uri string)
func SmartRedirect ¶
SmartRedirect redirects to uri but also adds query / fragment from r.URL
func TryServeFileFromFS ¶
func TryServeFileFromFS(w http.ResponseWriter, r *http.Request, opts *ServeFileOptions, fsPath string) bool
func TryServeURLFromFS ¶
func TryServeURLFromFS(w http.ResponseWriter, r *http.Request, opts *ServeFileOptions) bool
Types ¶
type ServeFileOptions ¶
type SimpleServerOptions ¶
Click to show internal directories.
Click to hide internal directories.