Documentation ¶
Index ¶
- Constants
- Variables
- func AddHeaders(req *http.Request, headers map[string]string)
- func GetJsonParamsBody(params map[string]string) (io.Reader, error)
- func GetUrlValues(params map[string]string) url.Values
- func PerformRequest(requestConfig RequestConfig, throttle chan int) error
- func RequestsInit(data []RequestConfig, concurrency int)
- func StartMonitoring()
- type RequestConfig
Constants ¶
View Source
const ( ContentType = "Content-Type" ContentLength = "Content-Length" FormContentType = "application/x-www-form-urlencoded" JsonContentType = "application/json" DefaultTime = "300s" DefaultResponseCode = http.StatusOK DefaultConcurrency = 1 )
Variables ¶
View Source
var (
RequestsList []RequestConfig
)
Functions ¶
func AddHeaders ¶
Add header values from map to request
func GetJsonParamsBody ¶
Creates body for request of type application/json from map
func GetUrlValues ¶
convert params in map to url.Values
func PerformRequest ¶
func PerformRequest(requestConfig RequestConfig, throttle chan int) error
takes the date from requestConfig and creates http request and executes it
func RequestsInit ¶
func RequestsInit(data []RequestConfig, concurrency int)
Initialize data from config file and check all requests
func StartMonitoring ¶
func StartMonitoring()
Start monitoring by calling createTicker method for each request
Types ¶
type RequestConfig ¶
type RequestConfig struct { Id int Url string `json:"url"` RequestType string `json:"requestType"` Headers map[string]string `json:"headers"` FormParams map[string]string `json:"formParams"` UrlParams map[string]string `json:"urlParams"` ResponseCode int `json:"responseCode"` ResponseTime int64 `json:"responseTime"` CheckEvery time.Duration `json:"checkEvery"` }
func (*RequestConfig) Validate ¶
func (requestConfig *RequestConfig) Validate() error
check whether all requestConfig fields are valid
Click to show internal directories.
Click to hide internal directories.