Documentation ¶
Index ¶
- func EnsureKeysAreFilled(m map[string]interface{}, keys ...string) error
- func GetRequestAPIToken(req *http.Request, headerName string) (string, error)
- func GetRequestAuthorizationToken(req *http.Request) (string, error)
- func GetRequestTokenCookie(req *http.Request) (string, error)
- func GetRequestTokenHeader(header http.Header, tokenType string) (string, error)
- func ParseBodyToMap(r *http.Request) (map[string]interface{}, error)
- func ParseResponseBodyToMap(r *http.Response) (map[string]interface{}, error)
- func ReadBody(r *http.Request) ([]byte, error)
- func ReadResponseBody(r *http.Response) ([]byte, error)
- func RestyGet(result interface{}, request *resty.Request, url string) (interface{}, error)
- type DebugTransport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureKeysAreFilled ¶
EnsureKeysAreFilled ensures that the given object (usually parsed from JSON) has the given keys and that given keys are not empty (all blank space)
func GetRequestAPIToken ¶
GetRequestAPIToken gets the API token from the given header
func GetRequestAuthorizationToken ¶
GetRequestAuthorizationToken gets a bearer token from either headers or cookies, or an error if it is contained in neither
func GetRequestTokenCookie ¶
GetRequestTokenCookie gets a token of the specified type ("Bearer", "Basic") from the cookies of a request
func GetRequestTokenHeader ¶
GetRequestTokenHeader gets a token of the specified type ("Bearer", "Basic") from the headers of a request
func ParseBodyToMap ¶
ParseBodyToMap parses a JSON body to map[string]interface{}, returning either an Internal Server Error or Bad Request Error on failure (depending on the issue)
func ParseResponseBodyToMap ¶
ParseResponseBodyToMap parses a JSON body to map[string]interface{}, returning either an Internal Server Error or Bad Request Error on failure (depending on the issue)
func ReadBody ¶
ReadBody reads all contents of a given request body, returning an Internal Server Error if it fails
func ReadResponseBody ¶
ReadResponseBody reads all contents of a given response body
Types ¶
type DebugTransport ¶
type DebugTransport struct {
Tripper http.RoundTripper
}
DebugTransport is used to print extra debug messages during http client calls