Global

Members

AuthLoader :AuthLoader

This object manages loading and finding Handlers for auth.

Type:
Source:

commands :function

stores all execution commands

Type:
  • function
Source:

(constant) FUNCTION :string

Type:
  • string
Source:

initialisers :Array

Functions executed with commands on start

Type:
  • Array
Source:

REQUEST_MODES :String

Different modes for a request body.

Type:
  • String
Properties:
Name Type Description
RAW String
URLENCODED String
FORMDATA String
FILE String
Source:

Run :Run

Expose Run instance for testability

Type:
Source:

triggers :Object

Stores all events that runner triggers

Type:
  • Object
Source:

Methods

(private) _extractField(string, regexp)

Extracts a Digest Auth field from a WWW-Authenticate header value using a given regexp.

Parameters:
Name Type Description
string String
regexp RegExp
Source:

(private) _getDigestAuthHeader(headers)

Returns the 'www-authenticate' header for Digest auth. Since a server can suport more than more auth-scheme, there can be more than one header with the same key. So need to loop over and check each one.

Parameters:
Name Type Description
headers VariableList
Source:

_lookup(options, hostLookup, hostname, callback)

Abstracts out the logic for domain resolution

Parameters:
Name Type Description
options
hostLookup
Properties
Name Type Description
type
hostIpMap
hostname
callback
Source:

(private) _schedule(action, payloadopt, argsopt, immediateopt)

Parameters:
Name Type Attributes Description
action String
payload Object <optional>
args Array <optional>
immediate Boolean <optional>
Source:

authorizeRequest(request, done) → {Request}

Creates a copy of request, with the appropriate auth headers or parameters added.

Parameters:
Name Type Description
request Request
done
Source:
Returns:
Type
Request

bof() → {Boolean}

Source:
Returns:
Type
Boolean

bounds(lengthopt, cyclesopt, callbackopt, scopeopt)

Update length and cycle bounds

Parameters:
Name Type Attributes Default Description
length Number <optional>
0
cycles Number <optional>
1
callback function <optional>

receives (err:Error, coords:Object, previous:Object)

scope Object <optional>
Source:

box(obj, boundsopt) → {Cursor}

Parameters:
Name Type Attributes Description
obj Object | Cursor
bounds Object <optional>
Properties
Name Type Attributes Description
length Number <optional>
cycles Number <optional>
Source:
Returns:
Type
Cursor

clear(callbackopt, scopeopt)

Set everything to mnimum dimension

Parameters:
Name Type Attributes Description
callback function <optional>

receives (err:Error, coords:Object, previous:Object)

scope Object <optional>
Source:

connect(host, port, callback)

Tries to make a TCP connection to the given host and port. If successful, the connection is immediately destroyed.

Parameters:
Name Type Description
host
port
callback
Source:

cr() → {Boolean}

Is the current position going to trigger a new iteration on .next?

Source:
Returns:
Type
Boolean

create(lengthopt, cyclesopt, positionopt, iterationopt, refopt) → {Number}

Parameters:
Name Type Attributes Default Description
length Number <optional>
0
cycles Number <optional>
1
position Number <optional>
0
iteration Number <optional>
0
ref String <optional>
Source:
Returns:
Type
Number

createItemContext(payload, defaultsopt) → {ItemContext}

Creates a context object to be used with http-request.command extension.

Parameters:
Name Type Attributes Description
payload Object
Properties
Name Type Attributes Description
item Item
coords Object <optional>
defaults Object <optional>
Properties
Name Type Attributes Description
replayState Object <optional>
coords Object <optional>
Source:
Returns:
Type
ItemContext

current() → {Object}

Current Cursor state

Source:
Returns:
Type
Object

empty() → {Boolean}

Source:
Returns:
Type
Boolean

eof() → {Boolean}

Source:
Returns:
Type
Boolean

extractRunnableItems(collection, entrypointopt, nullable, callback)

Extracts all the items on a collection starting from the entrypoint.

Parameters:
Name Type Attributes Description
collection Collection
entrypoint Object <optional>
<nullable>
Properties
Name Type Attributes Default Description
execute String <optional>

id of item or group to execute (can be name when used with idOrName)

path Array.<String> <optional>

path leading to the item or group selected (only for path strategy)

lookupStrategy String <optional>
idOrName

strategy to use for entrypoint lookup [idOrName, path]

callback function
Source:

findItemOrGroup(itemGroup, matchnullable) → {Item|ItemGroup|undefined}

Finds an item or item group based on id or name.

Parameters:
Name Type Attributes Description
itemGroup ItemGroup
match String <nullable>
Source:
Returns:
Type
Item | ItemGroup | undefined

findItemsOrGroups(itemGroup, entrypointSubset, _continueAccumulation, _accumulatedItems) → {Object}

Finds items based on multiple ids or names provided.

Parameters:
Name Type Description
itemGroup ItemGroup

Composite list of Item or ItemGroup.

entrypointSubset Object

Entry-points reference passed across multiple recursive calls.

_continueAccumulation Boolean

Flag used to decide whether to accumulate items or not.

_accumulatedItems Array.<String>

Found Items or ItemGroups.

Source:
Returns:
Type
Object

flattenNode(node) → {Array.<Item>}

Accumulate all items in order if entry point is a collection/folder. If an item is passed returns an array with that item.

Parameters:
Name Type Description
node ItemGroup | Item
Source:
Returns:
Type
Array.<Item>

hasChanged(coords) → {Boolean}

Check whether current position and iteration is not as the same specified

Parameters:
Name Type Description
coords Object
Source:
Returns:
Type
Boolean

immediate(action, payload)

Suspends current instruction and executes the given instruction.

This method explicitly chooses not to handle errors, to allow the caller to catch errors and continue execution without terminating the instruction queue. However, it is up to the caller to make sure errors are handled, or it will go unhandled.

Parameters:
Name Type Attributes Description
action String
payload Object
args... * <optional>
Source:

interrupt(action, payloadopt)

Parameters:
Name Type Attributes Description
action String
payload Object <optional>
args... * <optional>
Source:

load(state, callbackopt, scopeopt)

Parameters:
Name Type Attributes Description
state Object
Properties
Name Type Attributes Default Description
length Number <optional>
0
cycles Number <optional>
1
position Number <optional>
0
iteration Number <optional>
0
ref String <optional>
callback function <optional>

receives (err:Error, coords:Object, previous:Object)

scope Object <optional>
Source:

lookup(lookupOptions, hostname, options, callback)

Override DNS lookups in Node, to handle localhost as a special case. Chrome tries connecting to IPv6 by default, so we try the same thing.

Parameters:
Name Type Description
lookupOptions
Properties
Name Type Description
port
network
Properties
Name Type Description
restrictedAddresses
hostLookup
Properties
Name Type Description
type
hostIpMap
hostname
options
callback
Source:

lookupByIdOrName(collection, options, callback)

Finds an item or group on a collection with a matching id or name.

Parameters:
Name Type Description
collection Collection
options Object
Properties
Name Type Attributes Description
execute String <optional>
callback function
Source:

lookupByPath(collection, options, callback)

Finds an item or group from a path. The path should be an array of ids from the parent chain.

Parameters:
Name Type Description
collection Collection
options Object
Properties
Name Type Attributes Description
execute String
path Array.<String> <optional>
<nullable>
callback function
Source:

meetExpectations(subject, expectations, defaultsopt) → {Object}

ensure the specified keys are functions in subject

Parameters:
Name Type Attributes Description
subject Object
expectations Array
defaults Array <optional>
Source:
Returns:
Type
Object

next(callbackopt, scopeopt)

Seek one forward

Parameters:
Name Type Attributes Description
callback function <optional>

receives (err:Error, changed:Boolean, coords:Object, previous:Object)

scope Object <optional>
Source:

(private) normaliseIterationData(data, length) → {Array}

Parameters:
Name Type Description
data Array
length Number
Source:
Returns:
Type
Array

prepareLookupHash(items) → {Object}

Returns a hash of IDs and Names of items in an array

Parameters:
Name Type Description
items Array
Source:
Returns:
Type
Object

prepareRunConfig(optionsopt)

Prepares run config by combining runner config with given run options.

Parameters:
Name Type Attributes Description
options Object <optional>
Properties
Name Type Attributes Description
timeout Object <optional>
Properties
Name Type Attributes Description
global Object <optional>
request Object <optional>
script Object <optional>
Source:

queue(action, payloadopt)

Parameters:
Name Type Attributes Description
action String
payload Object <optional>
args... * <optional>
Source:

randomString(length)

Generates a random string of given length

Parameters:
Name Type Description
length Number
Source:
To Do:
  • Move this to util.js. After moving use that for hawk auth too

randomString(length)

Generates a random string of given length (useful for nonce generation, etc).

Parameters:
Name Type Description
length Number
Source:

reset(lengthopt, cyclesopt, positionopt, iterationopt, refopt, callbackopt, scopeopt)

Update length and cycle bounds

Parameters:
Name Type Attributes Default Description
length Number <optional>
0
cycles Number <optional>
1
position Number <optional>
0
iteration Number <optional>
0
ref String <optional>
callback function <optional>

receives (err:Error, coords:Object, previous:Object)

scope Object <optional>
Source:

(private) resolveCursor(cursor) → {Item}

Parameters:
Name Type Description
cursor Object | Cursor
Source:
Returns:
Type
Item

resolveVariables(context, payload)

Resolve variables in item and auth in context.

Parameters:
Name Type Description
context ItemContext
Properties
Name Type Attributes Description
item Item <optional>
auth RequestAuth <optional>
payload Object
Properties
Name Type Description
_variables VariableScope
data Object
environment VariableScope
collectionVariables VariableScope
globals VariableScope
Source:

run(collection, optionsopt, callback)

Runs a collection or a folder.

Parameters:
Name Type Attributes Description
collection Collection
options Object <optional>
Properties
Name Type Attributes Description
items Array.<Item>
data Array.<Object> <optional>
globals Object <optional>
environment Object <optional>
iterationCount Number <optional>
certificates CertificateList <optional>
proxies ProxyConfigList <optional>
data Array <optional>
entrypoint Object <optional>
Properties
Name Type Attributes Default Description
execute String <optional>

ID of the item-group to be run. Can be Name if entrypoint.lookupStrategy is idOrName

lookupStrategy String <optional>
idOrName

strategy to lookup the entrypoint [idOrName, path]

path Array.<String> <optional>

path to lookup

run Object <optional>

Run-specific options, such as options related to the host

callback function
Source:

(private) sanitizeFiles(request, callback)

Removes files in Request body if any.

Parameters:
Name Type Description
request Request~definition

Request JSON representation to be sanitized

callback function

function invoked with error, request and sanitisedFiles. sanitisedFiles is the list of files removed from request.

Source:

seek(positionopt, iterationopt, callbackopt, scopeopt)

Seek to a specified Cursor

Parameters:
Name Type Attributes Description
position Number <optional>
iteration Number <optional>
callback function <optional>

receives (err:Error, changed:Boolean, coords:Object, previous:Object)

scope Object <optional>
Source:

setCertificate(request, options, cb)

Gets the certificate from the options.certificate And appends it with the options provided

Parameters:
Name Type Description
request
options
cb
Source:

setProxy(request, options, cb)

Sets the Proxy and tunnel to the options

Parameters:
Name Type Description
request
options
cb
Source:

start(callback)

Parameters:
Name Type Description
callback function | Object
Source:

toChromeCookie(cookie) → {Object}

Creates a Chrome-compatible cookie from a tough-cookie compatible cookie.

Parameters:
Name Type Description
cookie
Source:
Returns:
Type
Object

transformMultiValueHeaders(acc, val, key) → {Object}

This method is used in conjunction with _.transform method to convert multi-value headers to multiple single value headers

Parameters:
Name Type Description
acc Array
val Array | String
key String
Source:
Returns:
Type
Object

transformRequestBody(accumulator, param) → {*}

An iterative helper to reduce formdata/urlencoded request bodies from object arrays to a singular aggregated object.

Parameters:
Name Type Description
accumulator Object

The resultant aggregated object representation for the request body.

param Object

One of many request body elements.

Properties
Name Type Description
disabled Boolean

A flag that can be set to true to indicate the disabled status of the param.

key String

The name of the current body parameter.

value String

The value of the current body parameter.

description String

The description associated with the current request body parameter.

Source:
Returns:
Type
*

(private) validate(num, min, maxopt) → {Number}

Parameters:
Name Type Attributes Description
num Number
min Number

[description]

max Number <optional>
Source:
Returns:
Type
Number

valueOf() → {Object}

Source:
Returns:
Type
Object

whatnext(coords) → {Object}

Tentative Cursor status, if we do .next()

Parameters:
Name Type Description
coords Object
Source:
Returns:
Type
Object

zero(callbackopt, scopeopt)

Set everything to minimum dimension

Parameters:
Name Type Attributes Description
callback function <optional>

receives (err:Error, coords:Object, previous:Object)

scope Object <optional>
Source:

Type Definitions

ItemContext

Type:
  • Object
Properties:
Name Type Description
coords Object

current cursor

originalItem Item

reference to the item in the collection

item Item

Holds a copy of the item given in the payload, so that it can be manipulated as necessary

auth RequestAuthBase | undefined

If present, is the instance of Auth in the collection, which is changed as necessary using intermediate requests, etc.

replayState ReplayState

has context on number of replays(if any) for this request

Source:

ReplayState

Defines the current replay state of a request.

By replay state, we mean the number of requests sent as part of one Collection requests. It can be intermediate requests, or replays of the same collection requests.

Type:
  • Object
Properties:
Name Type Description
count Number

total number of requests, including Collection requests and replays

Source: