Documentation ¶
Index ¶
- type DebugFunc
- type Interface
- type Pool
- type Request
- func (r *Request) Accept(accept string) Interface
- func (r *Request) AcceptCharset(acceptCharset string) Interface
- func (r *Request) AcceptEncoding(acceptEncoding string) Interface
- func (r *Request) AcceptLanguage(acceptLanguage string) Interface
- func (r *Request) BasicAuth(username string, password string) Interface
- func (r *Request) Cancel() Interface
- func (r *Request) ContentType(contentType string) Interface
- func (r *Request) Cookies(cookies []*http.Cookie) Interface
- func (r *Request) CustomHeader(name string, value string) Interface
- func (r *Request) DataBytes(data []byte) Interface
- func (r *Request) DataJSON(data interface{}) Interface
- func (r *Request) DataStream(data io.Reader) Interface
- func (r *Request) DataString(data string) Interface
- func (r *Request) DataXML(data interface{}) Interface
- func (r *Request) DebugFunc(fn DebugFunc) Interface
- func (r *Request) Do(client *http.Client) error
- func (r *Request) Done() Interface
- func (r *Request) DoneWithContext(ctx context.Context) Interface
- func (r *Request) Error() error
- func (r *Request) Header() transportHeader.Interface
- func (r *Request) Latency() time.Duration
- func (r *Request) MakeRequest() (err error)
- func (r *Request) Method(m methods.Value) Interface
- func (r *Request) Referer(referer string) Interface
- func (r *Request) Request() (ret *http.Request, err error)
- func (r *Request) Response() response.Interface
- func (r *Request) URL(url string) Interface
- func (r *Request) UserAgent(userAgent string) Interface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DebugFunc ¶
type DebugFunc func(data []byte)
DebugFunc Is an a function for debug request/response data
type Interface ¶
type Interface interface { // Cancel Aborting request Cancel() Interface // Done Waiting for the request to finish Done() Interface // DoneWithContext Waiting for a request to complete, with the ability to interrupt the request through the context DoneWithContext(ctx context.Context) Interface // Error Return latest error Error() error // DebugFunc Set debug func and enable or disable debug mode // If fn=not nil - debug mode is enabled. If fn=nil, debug mode is disbled DebugFunc(fn DebugFunc) Interface // Request Returns the http.Request prepared for the request Request() (*http.Request, error) // Method Set request method Method(methods.Value) Interface // URL Set request URL URL(url string) Interface // Referer Setting the referer header Referer(referer string) Interface // UserAgent Setting the UserAgent Request Header UserAgent(userAgent string) Interface // ContentType Setting the Content-Type request header ContentType(contentType string) Interface // Accept Setting the Accept request header Accept(accept string) Interface // AcceptEncoding Setting the Accept-Encoding request header AcceptEncoding(acceptEncoding string) Interface // AcceptLanguage Setting the Accept-Language request header AcceptLanguage(acceptLanguage string) Interface // Settings the Accept-Charset request header AcceptCharset(acceptCharset string) Interface // Settings custom request header CustomHeader(name string, value string) Interface // BasicAuth Set login and password for request basic authorization BasicAuth(username string, password string) Interface // Cookies Adding cookies to the request Cookies(cookies []*http.Cookie) Interface // Header is an interface for custom headers manipulation Header() header.Interface // Latency is an request latency without reading body of response Latency() time.Duration // Response is an response interface Response() response.Interface // DataStream Data for the request body in the form of an interface of io.Reader DataStream(data io.Reader) Interface // DataString Data for the request body in the form of an string DataString(data string) Interface // DataString Data for the request body in the form of an []byte DataBytes(data []byte) Interface // DataJSON The data for the query is created by serializing the object in JSON DataJSON(data interface{}) Interface // DataXML The data for the query is created by serializing the object in XML DataXML(data interface{}) Interface // Do Executing the query and getting the result Do(client *http.Client) error }
Interface is an request interface
type Pool ¶
type Pool interface { // RequestGet Извлечение из pool нового элемента Request RequestGet() Interface // RequestPut Возврат в sync.Pool использованного элемента Request RequestPut(req Interface) }
Pool is an interface of package
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
Request is an Request implementation
func (*Request) AcceptCharset ¶
Settings the Accept-Charset request header
func (*Request) AcceptEncoding ¶
AcceptEncoding Setting the Accept-Encoding request header
func (*Request) AcceptLanguage ¶
AcceptLanguage Setting the Accept-Language request header
func (*Request) ContentType ¶
ContentType Setting the Content-Type request header
func (*Request) CustomHeader ¶
Settings custom request header
func (*Request) DataJSON ¶
DataJSON The data for the query is created by serializing the object in JSON
func (*Request) DataStream ¶
DataStream Data for the request body in the form of an interface of io.Reader
func (*Request) DataString ¶
DataString Data for the request body in the form of an string
func (*Request) DataXML ¶
DataXML The data for the query is created by serializing the object in XML
func (*Request) DebugFunc ¶
DebugFunc Set debug func and enable or disable debug mode If fn=not nil - debug mode is enabled. If fn=nil, debug mode is disbled
func (*Request) DoneWithContext ¶
DoneWithContext Waiting for a request to complete, with the ability to interrupt the request through the context
func (*Request) Header ¶
func (r *Request) Header() transportHeader.Interface
Header is an interface for custom headers manipulation
func (*Request) MakeRequest ¶
MakeRequest Создание запроса на основе метода запроса