Documentation ¶
Index ¶
- func GetEnv(key, fallback string) string
- func GetLocalHostname() string
- func GetLocalIP() string
- func GetLocalUsername() string
- func HttpHelperRemovePort(s string) string
- func HttpHelperReturnClientIp(r *http.Request) string
- func HttpHelperReturnReferer(r *http.Request) string
- func HttpJsonResponse(w http.ResponseWriter, r *http.Request, httpStatusCode int, ...)
- func HttpLog(w http.ResponseWriter, r *http.Request, httpStatusCode int)
- func HttpRoute404(w http.ResponseWriter, r *http.Request)
- func HttpRouteDefault(w http.ResponseWriter, r *http.Request)
- func HttpRoutePing(w http.ResponseWriter, r *http.Request)
- func IsFlagPassed(name string) bool
- func IsStringInSlice(a string, list []string) bool
- func PrettyPrintStruct(i interface{}) string
- func RandomBool() bool
- func RandomNumberInRange(minNum int, maxNum int) int
- func RestGetUrl(url string, expectedReturnCode int) map[string]interface{}
- func RestJsonMarshalData(payload map[string]interface{}) []byte
- func RestJsonUnmarshalData(response []byte) map[string]interface{}
- func RestPerformGetUrl(url string) *http.Response
- func RestPerformPostUrl(url string, jsonData []byte) *http.Response
- func RestPostUrl(url string, payload map[string]interface{}, expectedReturnCode int) map[string]interface{}
- func RestResponseBody(resp *http.Response) []byte
- func RestResponseCodeAnalysis(resp *http.Response, expectedReturnCode int) bool
- func RestResponseGetHeader(resp *http.Response, name string) (string, error)
- func RestResponseReturnCode(resp *http.Response) int
- func StringToInt(theString string, quit bool) int
- func TimeNow() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLocalHostname ¶
func GetLocalHostname() string
func GetLocalIP ¶
func GetLocalIP() string
func GetLocalUsername ¶
func GetLocalUsername() string
func HttpHelperRemovePort ¶
if r.RemoteAddr contains port, remove it like: "127.0.0.1:53956" => "127.0.0.1"
func HttpHelperReturnReferer ¶
func HttpJsonResponse ¶
func HttpJsonResponse(w http.ResponseWriter, r *http.Request, httpStatusCode int, httpResponse interface{})
func HttpLog ¶
func HttpLog(w http.ResponseWriter, r *http.Request, httpStatusCode int)
Mimic NGINX Log Format
func HttpRoute404 ¶
func HttpRoute404(w http.ResponseWriter, r *http.Request)
func HttpRouteDefault ¶
func HttpRouteDefault(w http.ResponseWriter, r *http.Request)
func HttpRoutePing ¶
func HttpRoutePing(w http.ResponseWriter, r *http.Request)
not using jsonResponse, but writing byte style. Doing this as an example
func IsFlagPassed ¶
func IsStringInSlice ¶
func PrettyPrintStruct ¶
func PrettyPrintStruct(i interface{}) string
consume like: fmt.Println(helpers.PrettyPrintStruct(response))
func RandomBool ¶
func RandomBool() bool
func RandomNumberInRange ¶
func RestGetUrl ¶
Takes URL and returns JSON Params (string) of URL Params (int) of expected HTTP Response Code Returns (map[string]interface{}) of JSON response
func RestJsonMarshalData ¶
func RestJsonUnmarshalData ¶
func RestPerformGetUrl ¶
func RestPostUrl ¶
func RestResponseBody ¶
func RestResponseCodeAnalysis ¶
Get HTTP response Status Code
func RestResponseGetHeader ¶
Get specific Response Header
func RestResponseReturnCode ¶
Get HTTP response Status Code
func StringToInt ¶
Takes a string and returns an int. Params (string) to convert, (bool) if conversion fails, should program exit Returns (int) of string
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.