Documentation ¶
Index ¶
- func Dial(location *url.URL) string
- func HttpAcceptType(request *http.Request) string
- func HttpContentType(request *http.Request) string
- func HttpJsonDecode(request io.ReadCloser, size int64, data interface{}) error
- func HttpJsonEncode(body io.ReadCloser, size int64, data interface{}) ([]byte, error)
- func HttpJsonRequest(method, location string, payload, result interface{}, timeout time.Duration) error
- func HttpJsonSend(method, location string, payload, result interface{}, timeout time.Duration) (int, error)
- func IsJsonContent(r *http.Request) bool
- func JsonDecode(content []byte, result interface{}) error
- func JsonEncode(data interface{}) ([]byte, error)
- func RandomUUID(min int) string
- func ReadHttpContentBody(body io.ReadCloser, length int64) ([]byte, error)
- func TransferBytes(src io.Reader, dest io.Writer, wg *sync.WaitGroup) (int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HttpContentType ¶
Retrieve the content-type from the header of the request
request: the http request
func HttpJsonDecode ¶
func HttpJsonDecode(request io.ReadCloser, size int64, data interface{}) error
func HttpJsonEncode ¶
func HttpJsonEncode(body io.ReadCloser, size int64, data interface{}) ([]byte, error)
func HttpJsonRequest ¶
func HttpJsonRequest(method, location string, payload, result interface{}, timeout time.Duration) error
Essentially a wrapper for the HttpJsonSend method
method: the http method e.g. get, post etc location: the full url for the endpoint payload: a pointer to a structure which needs to be sent with the request result: the structure we should decode the output into
func HttpJsonSend ¶
func HttpJsonSend(method, location string, payload, result interface{}, timeout time.Duration) (int, error)
Performs a json request and decodes the result for us
method: the http method e.g. get, post etc location: the full url for the endpoint payload: a pointer to a structure which needs to be sent with the request result: the structure we should decode the output into
func IsJsonContent ¶
func JsonDecode ¶
Decode the content and place into the result structure
content: a string which hopefully contains some json object result: a structure you want to unmarshall the data into
func JsonEncode ¶
Encode the data structure in a json string
data: the structure you wish to marshal into json
func RandomUUID ¶
Generate a random number string of x amount
min: the length of the string you want generated
func ReadHttpContentBody ¶
func ReadHttpContentBody(body io.ReadCloser, length int64) ([]byte, error)
Read in the contents of a request
body: the io reader from the request / response length: the length of the content
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.