Documentation ¶
Index ¶
- Constants
- Variables
- func CreateTransport(timeout *Timeout, keepAlive bool) (ret *http.Transport)
- func Delete(url string, header http.Header, body io.Reader, timeout *Timeout) (*http.Response, error)
- func DeleteBytes(url string, header http.Header, body io.Reader, timeout *Timeout) ([]byte, error)
- func DeleteJson(url string, header http.Header, body io.Reader, timeout *Timeout, ...) error
- func DeleteXml(url string, header http.Header, body io.Reader, timeout *Timeout, ...) error
- func Get(url string, header http.Header, timeout *Timeout) (*http.Response, error)
- func GetBytes(url string, header http.Header, timeout *Timeout) ([]byte, error)
- func GetJson(url string, header http.Header, timeout *Timeout, v interface{}) error
- func GetXml(url string, header http.Header, timeout *Timeout, v interface{}) error
- func Post(url string, header http.Header, body io.Reader, timeout *Timeout) (*http.Response, error)
- func PostBytes(url string, header http.Header, body io.Reader, timeout *Timeout) ([]byte, error)
- func PostForm(url string, header http.Header, data url.Values, timeout *Timeout) (*http.Response, error)
- func PostFormBytes(url string, header http.Header, data url.Values, timeout *Timeout) ([]byte, error)
- func PostFormJson(url string, header http.Header, data url.Values, timeout *Timeout, ...) error
- func PostFormXml(url string, header http.Header, data url.Values, timeout *Timeout, ...) error
- func PostJson(url string, header http.Header, body io.Reader, timeout *Timeout, ...) error
- func PostXml(url string, header http.Header, body io.Reader, timeout *Timeout, ...) error
- func Put(url string, header http.Header, body io.Reader, timeout *Timeout) (*http.Response, error)
- func PutBytes(url string, header http.Header, body io.Reader, timeout *Timeout) ([]byte, error)
- func PutForm(url string, header http.Header, data url.Values, timeout *Timeout) (*http.Response, error)
- func PutFormBytes(url string, header http.Header, data url.Values, timeout *Timeout) ([]byte, error)
- func PutFormJson(url string, header http.Header, data url.Values, timeout *Timeout, ...) error
- func PutFormXml(url string, header http.Header, data url.Values, timeout *Timeout, ...) error
- func PutJson(url string, header http.Header, body io.Reader, timeout *Timeout, ...) error
- func PutXml(url string, header http.Header, body io.Reader, timeout *Timeout, ...) error
- func Request(method, url string, header http.Header, body io.Reader, timeout *Timeout) (*http.Response, error)
- func RequestBytes(method, url string, header http.Header, body io.Reader, timeout *Timeout) ([]byte, error)
- func RequestJson(method, url string, header http.Header, body io.Reader, timeout *Timeout, ...) error
- func RequestXml(method, url string, header http.Header, body io.Reader, timeout *Timeout, ...) error
- type Proxy
- type Timeout
Constants ¶
View Source
const ( HTTPHeaderAccept = "Accept" HTTPHeaderAcceptEncoding = "Accept-Encoding" HTTPHeaderAuthorization = "Authorization" HTTPHeaderCacheControl = "Cache-Control" HTTPHeaderContentDisposition = "Content-Disposition" HTTPHeaderContentEncoding = "Content-Encoding" HTTPHeaderContentLength = "Content-Length" HTTPHeaderContentMD5 = "Content-MD5" HTTPHeaderContentType = "Content-Type" HTTPHeaderContentLanguage = "Content-Language" HTTPHeaderDate = "Date" HTTPHeaderEtag = "ETag" HTTPHeaderExpires = "Expires" HTTPHeaderHost = "Host" HTTPHeaderLastModified = "Last-Modified" HTTPHeaderRange = "Range" HTTPHeaderLocation = "Location" HTTPHeaderOrigin = "Origin" HTTPHeaderServer = "Server" HTTPHeaderUserAgent = "User-Agent" HTTPHeaderIfModifiedSince = "If-Modified-Since" HTTPHeaderIfUnmodifiedSince = "If-Unmodified-Since" HTTPHeaderIfMatch = "If-Match" HTTPHeaderIfNoneMatch = "If-None-Match" )
Http Header name
View Source
const (
ContentTypeForm = "application/x-www-form-urlencoded"
)
Variables ¶
View Source
var (
ProxySetting = Proxy{}
)
Functions ¶
func CreateTransport ¶
CreateTransport 创建Transport, timeout可以为nil,使用ProxySetting
func DeleteBytes ¶
func DeleteJson ¶
func PostForm ¶
func PostForm(url string, header http.Header, data url.Values, timeout *Timeout) (*http.Response, error)
PostForm ContentType is not included in header. It is added auto.
func PostFormBytes ¶
func PostFormJson ¶
func PostFormXml ¶
func PutForm ¶
func PutForm(url string, header http.Header, data url.Values, timeout *Timeout) (*http.Response, error)
PutForm ContentType is not included in header. It is added auto.
func PutFormBytes ¶
func PutFormJson ¶
func PutFormXml ¶
func Request ¶
func Request(method, url string, header http.Header, body io.Reader, timeout *Timeout) (*http.Response, error)
Request require a http command.
func RequestBytes ¶
func RequestJson ¶
Types ¶
type Proxy ¶
type Proxy struct { Host string //host name User string //user name for auth. default is "" which means that doesn't use. Password string //password for auth. }
Proxy setting
type Timeout ¶
type Timeout struct { Connect time.Duration //connection timeout Read time.Duration //read timeout Write time.Duration //write timeout Header time.Duration //timeout for waiting Response Header Idle time.Duration //timeout for idle }
Timeout timeout setting. Default is 0 which means that doesn't use and use golang default setting.
Click to show internal directories.
Click to hide internal directories.