Documentation ¶
Index ¶
- Constants
- Variables
- func WithFileParams(files ...FileParam) *[]FileParam
- type Client
- type ClientOptions
- func WithBaseURL(baseURL string) ClientOptions
- func WithHeaders(headers Headers) ClientOptions
- func WithJsonMarshal(jsonMarshal func(v interface{}) ([]byte, error)) ClientOptions
- func WithJsonUnmarshal(jsonUnmarshal func(data []byte, v interface{}) error) ClientOptions
- func WithMaxConnsPerHost(maxConnsPerHost int) ClientOptions
- func WithOnBeforeRequest(onBeforeRequest OnBeforeRequest) ClientOptions
- func WithOnRequestCompleted(onRequestCompleted OnRequestCompleted) ClientOptions
- func WithOnRequestError(onRequestError OnRequestError) ClientOptions
- func WithTLSConfig(tlsConfig *tls.Config) ClientOptions
- func WithTimeout(timeout time.Duration) ClientOptions
- func WithUserAgent(userAgent string) ClientOptions
- type FileParam
- type Form
- type FormData
- type FormUrlEncoded
- type Headers
- type OnBeforeRequest
- type OnRequestCompleted
- type OnRequestError
- type Raw
- type Request
- type RequestInfo
- type Response
- type ResponseInfo
Constants ¶
View Source
const ( HeaderAuthorization = "Authorization" HeaderContentType = "Content-Type" )
Variables ¶
View Source
var ( HeaderContentTypeJson = "application/json" HeaderContentTypeJsonBytes = []byte(HeaderContentTypeJson) HeaderContentTypeFormUrlEncoded = "application/x-www-form-urlencoded" HeaderContentTypeFormUrlEncodedBytes = []byte(HeaderContentTypeFormUrlEncoded) )
Functions ¶
func WithFileParams ¶
Types ¶
type Client ¶
type Client interface { Get(request *Request) (*Response, error) Post(request *Request) (*Response, error) Put(request *Request) (*Response, error) Delete(request *Request) (*Response, error) Patch(request *Request) (*Response, error) Head(request *Request) (*Response, error) Options(request *Request) (*Response, error) }
func New ¶
func New(opts ...ClientOptions) Client
type ClientOptions ¶
type ClientOptions func(opts *clientOptions)
func WithBaseURL ¶
func WithBaseURL(baseURL string) ClientOptions
func WithHeaders ¶
func WithHeaders(headers Headers) ClientOptions
func WithJsonMarshal ¶
func WithJsonMarshal(jsonMarshal func(v interface{}) ([]byte, error)) ClientOptions
func WithJsonUnmarshal ¶
func WithJsonUnmarshal(jsonUnmarshal func(data []byte, v interface{}) error) ClientOptions
func WithMaxConnsPerHost ¶
func WithMaxConnsPerHost(maxConnsPerHost int) ClientOptions
func WithOnBeforeRequest ¶
func WithOnBeforeRequest(onBeforeRequest OnBeforeRequest) ClientOptions
func WithOnRequestCompleted ¶
func WithOnRequestCompleted(onRequestCompleted OnRequestCompleted) ClientOptions
func WithOnRequestError ¶
func WithOnRequestError(onRequestError OnRequestError) ClientOptions
func WithTLSConfig ¶
func WithTLSConfig(tlsConfig *tls.Config) ClientOptions
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ClientOptions
func WithUserAgent ¶
func WithUserAgent(userAgent string) ClientOptions
type FormUrlEncoded ¶
type OnBeforeRequest ¶
type OnBeforeRequest func(req *RequestInfo)
type OnRequestCompleted ¶
type OnRequestCompleted func(req *RequestInfo, resp *ResponseInfo)
type OnRequestError ¶
type OnRequestError func(req *RequestInfo, resp *ResponseInfo)
type RequestInfo ¶
type ResponseInfo ¶
Click to show internal directories.
Click to hide internal directories.