Documentation ¶
Overview ¶
This package contains helper functions for that are related to API calls.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BasicAuth ¶
It takes a username and password, concatenates them with a colon, encodes the resulting string in base64, and returns the encoded string - username: the username - password: the password - returns: the encoded string
func CallApi ¶
func CallApi(url string, method string, headers []Header, payload io.Reader, ignore_ssl bool) ([]byte, bool, error)
CallApi() is a function that takes a URL, a method, a list of headers, a payload, and a boolean to ignore SSL errors. It returns a byte array of result data, a boolean, and an error - url: the URL to call - method: the HTTP method to use POST GET PATH etc - headers: a list of headers to send with the request - payload: the data to send with the request - ignore_ssl: a boolean to ignore SSL errors - returns: a byte array of result data, a boolean is success, and an error if there is one
func CheckValidUrl ¶
CheckValidUrl Check If the host string contains either "http://" or "https://", return nil. Otherwise, return an error - host: the host string to check - returns: an error if the host string does not contain either "http://" or "https://"