Documentation ¶
Index ¶
- func GobDecoder(reader io.Reader, res interface{}) error
- func GobEncoder(payload interface{}) (io.Reader, error)
- func JsonDecoder(reader io.Reader, res interface{}) error
- func JsonEncoder(payload interface{}) (io.Reader, error)
- type DataDecoder
- type DataEncoder
- type Err
- type HttpClient
- func (c *HttpClient) DoRequest(ctx context.Context, method string, url string, headers map[string]string, ...) (*http.Response, error)
- func (c *HttpClient) DoRequestWithOptions(options RequestOptions) (*http.Response, error)
- func (c *HttpClient) GetRequest(ctx context.Context, url string, headers map[string]string, result interface{}) (*http.Response, error)
- func (c *HttpClient) PostRequest(ctx context.Context, url string, headers map[string]string, ...) (*http.Response, error)
- func (c *HttpClient) SetHeaders(headers map[string]string)
- type HttpClientParams
- type RequestOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GobDecoder ¶
func GobEncoder ¶
func JsonDecoder ¶
func JsonEncoder ¶
Types ¶
type DataDecoder ¶
type DataEncoder ¶
type Err ¶
type Err struct { Code int `json:"code"` Message string `json:"message"` Meta interface{} `json:"meta"` }
func (Err) MarshalJSON ¶
type HttpClient ¶
type HttpClient struct {
// contains filtered or unexported fields
}
func NewHttpClient ¶
func NewHttpClient(params HttpClientParams) *HttpClient
func (*HttpClient) DoRequestWithOptions ¶
func (c *HttpClient) DoRequestWithOptions(options RequestOptions) (*http.Response, error)
func (*HttpClient) GetRequest ¶
func (*HttpClient) PostRequest ¶
func (*HttpClient) SetHeaders ¶
func (c *HttpClient) SetHeaders(headers map[string]string)
type HttpClientParams ¶
type HttpClientParams struct { BaseUrl string ErrorHandler func(closer io.Reader) error IsError func(resp *http.Response) bool Headers map[string]string Timeout time.Duration RequestPayloadEncoder DataEncoder RequestPayloadDecoder DataDecoder MaxIdleConnsPerHost int ContextRequestId string HeaderKeyRequestID string DebugMode bool }
type RequestOptions ¶
type RequestOptions struct { Ctx context.Context Method string Url string Headers map[string]string Payload interface{} Result interface{} RequestPayloadEncoder DataEncoder RequestPayloadDecoder DataDecoder UrlParams map[string]string CookieList []*http.Cookie AfterCallback func(req *http.Request, resp *http.Response) }
Click to show internal directories.
Click to hide internal directories.