Documentation ¶
Index ¶
Constants ¶
const ( IsPrivateIP = 1 IsPublicIP = 2 )
Variables ¶
var ErrBatchForbiddenInInitContext = common.NewInitContextError("Using batch in the init context is not supported")
ErrBatchForbiddenInInitContext is used when batch was made in the init context
var ErrHTTPForbiddenInInitContext = common.NewInitContextError("Making http requests in the init context is not supported")
ErrHTTPForbiddenInInitContext is used when a http requests was made in the init context
var ErrJarForbiddenInInitContext = common.NewInitContextError("Making cookie jars in the init context is not supported")
ErrJarForbiddenInInitContext is used when a cookie jar was made in the init context TODO: unexport this? there's no reason for this to be exported
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a stand-alone HTTP client.
TODO: move to its own file
func (*Client) Batch ¶
Batch makes multiple simultaneous HTTP requests. The provideds reqsV should be an array of request objects. Batch returns an array of responses and/or error
func (*Client) SetResponseCallback ¶
SetResponseCallback sets the responseCallback to the value provided. Supported values are expectedStatuses object or a `null` which means that metrics shouldn't be tagged as failed and `http_req_failed` should not be emitted - the behaviour previous to this
type CookieJar ¶
type CookieJar struct { // js is to make it not be accessible from inside goja/js, the json is // for when it is returned from setup(). Jar *cookiejar.Jar `js:"-" json:"-"` // contains filtered or unexported fields }
CookieJar is cookiejar.Jar wrapper to be used in js scripts
func (CookieJar) CookiesForURL ¶
CookiesForURL return the cookies for a given url as a map of key and values
type ModuleInstance ¶
type ModuleInstance struct {
// contains filtered or unexported fields
}
ModuleInstance represents an instance of the HTTP module for every VU.
func (*ModuleInstance) Exports ¶
func (mi *ModuleInstance) Exports() modules.Exports
Exports returns the JS values this module exports.
type Response ¶
Response is a representation of an HTTP response to be returned to the goja VM
func (*Response) ClickLink ¶
ClickLink parses the body as an html, looks for a link and than makes a request as if the link was clicked
type RootModule ¶
type RootModule struct {
// contains filtered or unexported fields
}
RootModule is the global module object type. It is instantiated once per test run and will be used to create HTTP module instances for each VU.
TODO: add sync.Once for all of the deprecation warnings we might want to do for the old k6/http APIs here, so they are shown only once in a test run.
func New ¶
func New(workerInfo *libWorker.WorkerInfo) *RootModule
New returns a pointer to a new HTTP RootModule.
func (*RootModule) NewModuleInstance ¶
func (r *RootModule) NewModuleInstance(vu modules.VU) modules.Instance
NewModuleInstance returns an HTTP module instance for each VU.