Documentation
¶
Index ¶
- func ParallelRequest(reqs []Request, N int) []datastructure.Response
- type Request
- func (req *Request) AddCookie(c ...*http.Cookie) error
- func (req *Request) AddHeader(key, value string) error
- func (req *Request) CreateHeaderList(headers ...string) error
- func (req *Request) ExecuteRequest(client *http.Client) datastructure.Response
- func (req *Request) SendRequest(url, method string, bodyData []byte, headers []string, skipTLS bool, ...) *datastructure.Response
- func (req *Request) SetBasicAuth(username, password string)
- func (req *Request) SetBearerAuth(token string) error
- func (req *Request) SetTLS(skipTLS bool)
- func (req *Request) SetTimeout(t time.Duration)
- func (req *Request) SetTransportLayer(tl *http.Transport)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParallelRequest ¶ added in v0.2.3
func ParallelRequest(reqs []Request, N int) []datastructure.Response
ParallelRequest is delegated to run the given list of request in parallel, sending N request at each time
Types ¶
type Request ¶ added in v0.2.3
type Request struct {
Req *http.Request // Request
Tr *http.Transport // Transport layer, used for enable/disable TLS verification
Method string // HTTP method of the request
URL string // URL where send the request
Data []byte // BODY in case of POST, ARGS in case of GET
Resp datastructure.Response // Struct for save the response
Timeout time.Duration // Timeout of the request
}
Request will contain all the data related to the current HTTP request and response.
func InitDebugRequest ¶ added in v0.2.3
func InitDebugRequest() Request
InitDebugRequest is delegated to set the log level in order to debug the flow
func InitRequest ¶ added in v0.2.3
InitRequest is delegated to initialize a new request with the given parameter. NOTE: it will use the default timeout -> NO TIMEOUT. In order to specify a different timeout you can use the delegated method NOTE: headers have to be set with the delegated method
func (*Request) AddCookie ¶ added in v0.2.4
AddCookie is delegated to add the given list of cookie to the request
func (*Request) AddHeader ¶ added in v0.3.6
AddHeader is delegated to add a new header to the request
func (*Request) CreateHeaderList ¶ added in v0.2.3
CreateHeaderList is delegated to initialize a list of headers. Every row of the matrix contains [key,value]
func (*Request) ExecuteRequest ¶ added in v0.2.3
func (req *Request) ExecuteRequest(client *http.Client) datastructure.Response
ExecuteRequest is delegated to run a previously allocated request.
func (*Request) SendRequest ¶ added in v0.2.3
func (req *Request) SendRequest(url, method string, bodyData []byte, headers []string, skipTLS bool, timeout time.Duration) *datastructure.Response
SendRequest is delegated to initialize a new HTTP request.
func (*Request) SetBasicAuth ¶ added in v0.3.5
SetBasicAuth is delegated to compute the Basic Authentication value for the given data
func (*Request) SetBearerAuth ¶ added in v0.3.5
SetBearerAuth is delegated to compute the Bearer token for the given data
func (*Request) SetTLS ¶ added in v0.2.3
SetTLS is delegated to enable/disable TLS certificate validation
func (*Request) SetTimeout ¶ added in v0.2.3
SetTimeout is delegated to validate the given timeout and set to the request
func (*Request) SetTransportLayer ¶ added in v0.3.7
Directories
¶
| Path | Synopsis |
|---|---|
|
A go webserver for benchmark the request
|
A go webserver for benchmark the request |