Documentation ¶
Index ¶
- Variables
- func AddURLPath(urlStr string, paths ...string) (string, error)
- func CleanString(s string) string
- func DecodeUTF8(bytes []byte) string
- func GetHTTPClient() *http.Client
- func GetInsecureHTTPClient() *http.Client
- func JoinNonEmpty(delim string, strings ...string) string
- func MapAsJSON(m map[string]string) []byte
- func NullStringIfEmpty(s string) null.String
- func PutS3File(s3Client s3iface.S3API, bucket string, path string, contentType string, ...) (string, error)
- func StringArrayContains(s []string, e string) bool
- func TestS3(s3Client s3iface.S3API, bucket string) error
- type NullMap
- type RequestResponse
- type RequestResponseStatus
Constants ¶
This section is empty.
Variables ¶
var (
HTTPUserAgent = "Courier/vDev"
)
Functions ¶
func CleanString ¶ added in v0.2.0
CleanString removes any control characters from the passed in string
func DecodeUTF8 ¶
DecodeUTF8 is equivalent to .decode('utf-8', 'ignore') in Python
func GetHTTPClient ¶
GetHTTPClient returns the shared HTTP client used by all Courier threads
func GetInsecureHTTPClient ¶ added in v0.2.0
GetInsecureHTTPClient returns the shared HTTP client used by all Courier threads
func JoinNonEmpty ¶
JoinNonEmpty takes a vararg of strings and return the join of all the non-empty strings with a delimiter between them
func NullStringIfEmpty ¶ added in v1.0.5
func NullStringIfEmpty(s string) null.String
func PutS3File ¶
func PutS3File(s3Client s3iface.S3API, bucket string, path string, contentType string, contents []byte) (string, error)
PutS3File writes the passed in file to the bucket with the passed in content type
func StringArrayContains ¶
StringArrayContains returns whether a given string array contains the given element
Types ¶
type NullMap ¶
NullMap is a one level deep dictionary that is represented as JSON in the database
func NewNullMap ¶ added in v0.8.0
NewNullMap creates a new null map with the passed in map
func (*NullMap) MarshalJSON ¶
MarshalJSON decodes our dictionary from the passed in bytes
func (*NullMap) UnmarshalJSON ¶
UnmarshalJSON sets our dict from the passed in data
type RequestResponse ¶ added in v0.2.0
type RequestResponse struct { Method string URL string Status RequestResponseStatus StatusCode int Request string Response string Body []byte Elapsed time.Duration }
RequestResponse represents both the outgoing request and response for a particular URL/method/body
func MakeHTTPRequest ¶
func MakeHTTPRequest(req *http.Request) (*RequestResponse, error)
MakeHTTPRequest fires the passed in http request, returning any errors encountered. RequestResponse is always set regardless of any errors being set
func MakeInsecureHTTPRequest ¶ added in v0.2.0
func MakeInsecureHTTPRequest(req *http.Request) (*RequestResponse, error)
MakeInsecureHTTPRequest fires the passed in http request against a transport that does not validate SSL certificates.
type RequestResponseStatus ¶ added in v0.2.0
type RequestResponseStatus string
RequestResponseStatus represents the status of a WebhookRequeset
const ( // RRStatusSuccess represents that the webhook was successful RRStatusSuccess RequestResponseStatus = "S" // RRConnectionFailure represents that the webhook had a connection failure RRConnectionFailure RequestResponseStatus = "F" // RRStatusFailure represents that the webhook had a non 2xx status code RRStatusFailure RequestResponseStatus = "E" )