Documentation ¶
Overview ¶
HTTP Client which handles generic error routing and marshaling
Index ¶
- Variables
- type HttpClient
- func (h *HttpClient) HttpDelete(url string, data interface{}, result interface{}) *Response
- func (h *HttpClient) HttpGet(url string, result interface{}) *Response
- func (h *HttpClient) HttpPost(url string, data interface{}, result interface{}) *Response
- func (h *HttpClient) HttpPut(url string, data interface{}, result interface{}) *Response
- type HttpClientConfig
- type Method
- type Request
- type Response
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // invalid or error response ErrorInvalidResponse = errors.New("Invalid response from Remote") // some resource does not exists ErrorNotFound = errors.New("The resource does not exist") // Generic Error Message ErrorMessage = errors.New("Unknown error message was captured") // Not Authorized ErrorNotAuthorized = errors.New("Not Authorized to perform this action - Status: 403") // Not Authenticated ErrorNotAuthenticated = errors.New("Not Authenticated to perform this action - Status: 401") )
Functions ¶
This section is empty.
Types ¶
type HttpClient ¶
type HttpClient struct {
// contains filtered or unexported fields
}
func DefaultHttpClient ¶ added in v0.8.3
func DefaultHttpClient() *HttpClient
func NewHttpClient ¶
func NewHttpClient(config HttpClientConfig) *HttpClient
func (*HttpClient) HttpDelete ¶
func (h *HttpClient) HttpDelete(url string, data interface{}, result interface{}) *Response
func (*HttpClient) HttpGet ¶
func (h *HttpClient) HttpGet(url string, result interface{}) *Response
func (*HttpClient) HttpPost ¶
func (h *HttpClient) HttpPost(url string, data interface{}, result interface{}) *Response
func (*HttpClient) HttpPut ¶
func (h *HttpClient) HttpPut(url string, data interface{}, result interface{}) *Response
type HttpClientConfig ¶
type HttpClientConfig struct { sync.RWMutex // Http Basic Auth Username HttpUser string // Http Basic Auth Password HttpPass string // Request timeout RequestTimeout int // TLS Insecure Skip Verify TLSInsecureSkipVerify bool }
func NewDefaultConfig ¶
func NewDefaultConfig() *HttpClientConfig
Click to show internal directories.
Click to hide internal directories.