Documentation
¶
Index ¶
Constants ¶
View Source
const (
// HeaderContentType the Content-Type http header
HeaderContentType = "Content-Type"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HttpClient ¶
type HttpClient interface {
// HttpGet get http resource
HttpGet(url string) (resp *http.Response, err error)
// HttpGetWithCookie get http resource with cookies
HttpGetWithCookie(url string, header http.Header, cookies ...*http.Cookie) (resp *http.Response, err error)
// HttpPost send a post request with form data
HttpPost(url string, data url.Values) (resp *http.Response, err error)
// HttpPostWithCookie send a post request with form data and cookies
HttpPostWithCookie(url string, data url.Values, cookies ...*http.Cookie) (resp *http.Response, err error)
// HttpPostFileChunkWithCookie send a post request with form data, a file chunk and cookies
HttpPostFileChunkWithCookie(url string, fieldName string, fileName string, data url.Values, chunk []byte, cookies ...*http.Cookie) (resp *http.Response, err error)
// HttpPostWithoutRedirect send a post request with form data and not auto redirect
HttpPostWithoutRedirect(url string, data url.Values) (resp *http.Response, err error)
// Download if the local file does not exist and the alwaysDownload is false, downloads the remote file to local path
Download(path, url string, alwaysDownload bool) error
// HttpPostData send a post request with data
HttpPostData(url string, data []byte) (resp *http.Response, err error)
// HttpPut send a put request with data
HttpPut(url string, data []byte) (resp *http.Response, err error)
// HttpDelete send a delete request with data
HttpDelete(url string, data []byte) (resp *http.Response, err error)
}
HttpClient an HTTP client component that supports chunked file uploads using the POST method
func NewHttpClient ¶
func NewHttpClient(insecureSkipVerify bool, certFile string, enableHTTP3 bool) (HttpClient, error)
NewHttpClient create a http client
Click to show internal directories.
Click to hide internal directories.