Documentation ¶
Index ¶
- Variables
- func BindResponseJSON(response *http.Response, v interface{}) error
- func GetRequestID(request *http.Request) string
- func NewRequest(opts ...RequestOpt) (*http.Request, error)
- func PartFromData(fieldName, fileName string, data interface{}) *part
- func PartFromDiskFile(fieldName, fileName, diskPath string) *part
- func ReadResponseBody(response *http.Response) ([]byte, error)
- type Client
- type ClientOpt
- type RequestOpt
- func BasicAuth(username, password string) RequestOpt
- func BearerToken(token string) RequestOpt
- func Body(body io.Reader) RequestOpt
- func ContentType(contentType string) RequestOpt
- func Cookie(cookie *http.Cookie) RequestOpt
- func FormBody(form *url.Values) RequestOpt
- func Header(key, value string) RequestOpt
- func Host(host string) RequestOpt
- func JSONBody(body interface{}) RequestOpt
- func Method(method string) RequestOpt
- func MultipartForm(parts ...*part) RequestOpt
- func RandomRequestID() RequestOpt
- func URL(url string) RequestOpt
- func UserAgent(userAgent string) RequestOpt
Constants ¶
This section is empty.
Variables ¶
View Source
var CONNECT = Method("CONNECT")
View Source
var DELETE = Method("DELETE")
View Source
var GET = Method("GET")
View Source
var HEAD = Method("HEAD")
View Source
var OPTIONS = Method("OPTIONS")
View Source
var POST = Method("POST")
View Source
var PUT = Method("PUT")
View Source
var TRACE = Method("TRACE")
Functions ¶
func BindResponseJSON ¶
func GetRequestID ¶
func NewRequest ¶
func NewRequest(opts ...RequestOpt) (*http.Request, error)
func PartFromData ¶
func PartFromData(fieldName, fileName string, data interface{}) *part
func PartFromDiskFile ¶
func PartFromDiskFile(fieldName, fileName, diskPath string) *part
Types ¶
type RequestOpt ¶
type RequestOpt = func(*requestConfig) error
func BasicAuth ¶
func BasicAuth(username, password string) RequestOpt
func BearerToken ¶
func BearerToken(token string) RequestOpt
func Body ¶
func Body(body io.Reader) RequestOpt
func ContentType ¶
func ContentType(contentType string) RequestOpt
func Cookie ¶
func Cookie(cookie *http.Cookie) RequestOpt
func FormBody ¶
func FormBody(form *url.Values) RequestOpt
func Header ¶
func Header(key, value string) RequestOpt
func Host ¶
func Host(host string) RequestOpt
func JSONBody ¶
func JSONBody(body interface{}) RequestOpt
func Method ¶
func Method(method string) RequestOpt
func MultipartForm ¶
func MultipartForm(parts ...*part) RequestOpt
func RandomRequestID ¶
func RandomRequestID() RequestOpt
func URL ¶
func URL(url string) RequestOpt
func UserAgent ¶
func UserAgent(userAgent string) RequestOpt
Click to show internal directories.
Click to hide internal directories.