Documentation ¶
Index ¶
Constants ¶
const ( // AttemptsPosition in Args AttemptsPosition = 1 // ConcurrentAttemptsPosition in Args ConcurrentAttemptsPosition = 2 )
Variables ¶
var ( // ErrInvalidArgumentsNumber is an error when the number of arguments are invalid ErrInvalidArgumentsNumber = errors.New("invalid number of arguments") // ErrMethodNotAllowed is an error with bad config method ErrMethodNotAllowed = errors.New("Method not allowed") // ErrEmptyName is an error with bad Config method ErrEmptyName = errors.New("Request Config name cannot be nil") )
Functions ¶
func ParseIntArgument ¶
ParseIntArgument tries to parse an int argument. If it wasn't possible, returns default value
func PrintResults ¶
func PrintResults(result Result)
PrintResults output results accord to spec in github.com/pedrolopesme/call-it/issues/6
Types ¶
type ConcurrentCall ¶
type ConcurrentCall struct { URL *url.URL // The endpoint to be tested Attempts int // number of Attempts ConcurrentAttempts int // number of concurrent Attempts // contains filtered or unexported fields }
A ConcurrentCall represents the very basic structure to start calling some URL out. It carries all data needed to call-it operate on.
func BuildCall ¶
func BuildCall(args []string, maxAttempts, maxConcurrentAttempts int) (call ConcurrentCall, err error)
BuildCall parses all given arguments and transform them into a ConcurrentCall
func BuildCallsFromConfig ¶
func BuildCallsFromConfig() (calls []ConcurrentCall, err error)
BuildCallsFromConfig parses a Config file and transforms the instructions into a list of ConcurrentCalls
func (*ConcurrentCall) MakeIt ¶
func (call *ConcurrentCall) MakeIt() (result Result)
MakeIt executes a call and return its results
type Config ¶
type Config struct { Name string `json:"name,omitempty"` Func string `json:"func,omitempty"` Method string `json:"method"` Attempts int `json:"attempts,omitempty"` ConcurrentAttempts int `json:"concurrent,omitempty"` URL string `json:"url"` Body string `json:"body,omitempty"` Header map[string][]string `json:"header,omitempty"` Host string `json:"host"` Form string `json:"form,omitempty"` PostForm map[string][]string `json:"postform,omitempty"` }
Config is the structure that defines how the user should define the config.json file to make custom requests
type HTTPResponse ¶
type HTTPResponse struct {
// contains filtered or unexported fields
}
HTTPResponse status code and execution time
type StatusCodeBenchmark ¶
type StatusCodeBenchmark struct {
// contains filtered or unexported fields
}
StatusCodeBenchmark with total of occurrences, execution time