Documentation
¶
Index ¶
- Variables
- func BasicAuthRequest(method, url string, body io.Reader, deadline, dialTimeout time.Duration, ...) ([]byte, int, error)
- func CookiesGet(url string, deadline, dialTimeout time.Duration, header map[string]string) ([]byte, []*http.Cookie, error)
- func GetRequestWithBasicAuth(url string, deadline, dialTimeout time.Duration, username, password string) ([]byte, int, error)
- func PatchJSON(url string, data interface{}, deadline, dialTimeout time.Duration) ([]byte, int, error)
- func PostForm(url string, data []byte, deadline, dialTimeout time.Duration) ([]byte, int, error)
- func PostJSON(url string, data interface{}, deadline, dialTimeout time.Duration) ([]byte, int, error)
- func Request(method, url string, body io.Reader, deadline, dialTimeout time.Duration, ...) ([]byte, int, error)
- func RequestCookies(method, url string, body io.Reader, deadline, dialTimeout time.Duration, ...) ([]byte, []*http.Cookie, error)
- func RequestWithProxy(method, url string, body io.Reader, deadline, dialTimeout time.Duration, ...) ([]byte, int, error)
- func SimpleDelete(url string, deadline, dialTimeout time.Duration) ([]byte, int, error)
- func SimpleGet(url string, deadline, dialTimeout time.Duration) ([]byte, int, error)
- func SimplePut(url string, deadline, dialTimeout time.Duration) ([]byte, int, error)
- type HttpResponse
- type Proxy
- type RespData
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ContentTypeTextXml = "text/xml" ContentTypeHtml = "text/html; charset=utf-8" ContentTypeTextCss = "text/css; charset=utf-8" ContentTypeXJS = "application/x-javascript" ContentTypeJS = "text/javascript" ContentTypeJson = "application/json; charset=utf-8" ContentTypeForm = "application/x-www-form-urlencoded" ContentTypeImg = "image/png" )
Functions ¶
func BasicAuthRequest ¶
func BasicAuthRequest(method, url string, body io.Reader, deadline, dialTimeout time.Duration, header map[string]string, username, password string) ([]byte, int, error)
BasicAuthRequest - send an http Request
func CookiesGet ¶
func CookiesGet(url string, deadline, dialTimeout time.Duration, header map[string]string) ([]byte, []*http.Cookie, error)
CookiesGet - send an http get Request, response cookies
func GetRequestWithBasicAuth ¶
func GetRequestWithBasicAuth(url string, deadline, dialTimeout time.Duration, username, password string) ([]byte, int, error)
GetRequestWithBasicAuth - get request with Basic Auth
func PatchJSON ¶
func PatchJSON(url string, data interface{}, deadline, dialTimeout time.Duration) ([]byte, int, error)
PatchJSON - send an http patch json Request.
func PostJSON ¶
func PostJSON(url string, data interface{}, deadline, dialTimeout time.Duration) ([]byte, int, error)
PostJSON - send an http post json Request.
func Request ¶
func Request(method, url string, body io.Reader, deadline, dialTimeout time.Duration, header map[string]string) ([]byte, int, error)
Request - send an http Request
func RequestCookies ¶
func RequestCookies(method, url string, body io.Reader, deadline, dialTimeout time.Duration, header map[string]string, cookies []*http.Cookie) ([]byte, []*http.Cookie, error)
RequestCookies - send an http Request with cookies
func RequestWithProxy ¶ added in v1.0.2
func RequestWithProxy(method, url string, body io.Reader, deadline, dialTimeout time.Duration, header map[string]string, proxy *Proxy) ([]byte, int, error)
RequestWithProxy - send an http Request with http proxy
func SimpleDelete ¶
SimpleDelete - send an simple http delete Request
Types ¶
type HttpResponse ¶
type HttpResponse struct { Code int `json:"Code"` Message string `json:"Message"` Data interface{} `json:"Data,omitempty"` }
HttpResponse - htt Response
func (*HttpResponse) Response ¶
func (h *HttpResponse) Response(resp http.ResponseWriter)
Response - write data to resp
func (*HttpResponse) ResponseWithErr ¶
func (h *HttpResponse) ResponseWithErr(resp http.ResponseWriter, err error)
ResponseWithErr - write data to resp with error
Click to show internal directories.
Click to hide internal directories.