Documentation ¶
Index ¶
- type HttpRestClient
- func (h *HttpRestClient) Delete(url string) (string, error)
- func (h *HttpRestClient) Get(url string) (string, error)
- func (h *HttpRestClient) Post(url string, reqBody []byte) (string, error)
- func (h *HttpRestClient) PostJson(url string, reqBody interface{}) (string, error)
- func (h *HttpRestClient) PostUrlEncode(urlPath string, reqBody interface{}) (string, error)
- func (h *HttpRestClient) PostWithBasicAuth(url string, username string, password string, reqBody []byte) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HttpRestClient ¶
type HttpRestClient struct { Client *http.Client RootUrl string ContentType string Headers map[string]string }
Wrapper for http.Client that provides a stateful object to make HTTP requests against. Provides some boilerplate to reduce code duplication.
func NewHttpRestClient ¶
func NewHttpRestClient(rootUrl string, contentType string, ignoreTls bool) (*HttpRestClient, error)
Creates a new HttpRestClient that will make all requests from RootUrl with the specified settings.
func (*HttpRestClient) Post ¶
func (h *HttpRestClient) Post(url string, reqBody []byte) (string, error)
Performs a POST request against the specified URI and []byte body payload. Utilizes state of referenced HttpRestClient object and returns the contents of the response body in string form.
func (*HttpRestClient) PostJson ¶
func (h *HttpRestClient) PostJson(url string, reqBody interface{}) (string, error)
func (*HttpRestClient) PostUrlEncode ¶
func (h *HttpRestClient) PostUrlEncode(urlPath string, reqBody interface{}) (string, error)
func (*HttpRestClient) PostWithBasicAuth ¶
Click to show internal directories.
Click to hide internal directories.