networkRequest

networkRequest

Contains constants and functions for a Network Request.

The structure for a Network Request is as follows:

{
  payload: {
    body: <object>,
    initiator: <string>,
    location: {
      domain: <string>,
      hash: <string>,
      host: <string>,
      hostname: <string>,
      origin: <string>,
      path: <string>,
      port: <string>,
      protocol: <string>,
      query: <string>,
    },
    method: <string>,
    requestId: <string>,
    url: <string>,
  },
  type: 'netreq'
  annotations: <array>,
  clientId: <string>,
  timestamp: <number>,
  uuid: <string>,
}
Source:

Members

(static, constant) group

A grouping for this object

Source:

(static, constant) label

A label that can be used when describing this object

Source:

(static, constant) matcher

Matcher can be used to find matching Network Request objects.

Source:
See:
  • kit.match

(static, constant) parentDepth

Describes the number of parents this object has based off schema references. When checking for matches for example, we want to use a schema that is more specific over a more generic schema

Source:

(static, constant) path :string

Paths for the keys on a Network Request

Properties:
Name Type Description
payload string

An object with custom data describing the event.
Path is payload.

body string

The posted body. This is a fully parsed object..
Path is payload.body.

initiator string

The webpage that initiated the request..
Path is payload.initiator.

location string

Parsed information from the request URL..
Path is payload.location.

domain string

The domain portion of the request URL..
Path is payload.location.domain.

hash string

The hash portion of the request URL..
Path is payload.location.hash.

host string

The host portion of the request URL. Includes port number.
Path is payload.location.host.

hostname string

The host portion of the request URL without the port number..
Path is payload.location.hostname.

origin string

The origin portion of the request URL..
Path is payload.location.origin.

path string

The path of the request URL..
Path is payload.location.path.

port string

The port of the request URL..
Path is payload.location.port.

protocol string

The protocol portion of the request URL..
Path is payload.location.protocol.

query string

The query string portion of the request URL..
Path is payload.location.query.

method string

HTTP method that the request is made with..
Path is payload.method.

requestId string

ID that can be used to pair requests with responses..
Path is payload.requestId.

url string

The URL the request is being made to. Contains the full host, path, and query string..
Path is payload.url.

rootType string

The type of event. For network requests it's always 'netreq'..
Path is type.

annotations string

Array of Annotation objects.
Path is annotations.

clientId string

A unique id that differentiates clients from one another.
Path is clientId.

timestamp string

When the event occurred.
Path is timestamp.

rootId string

Uniquely identifies each event.
Path is uuid.

Source:

(static, constant) ROOT_TYPE

The value for rootType for a Network Request.

Path is type.

Source:

Methods

(static) get(alias, data) → {*}

Retrieves a value from the object. You can provide either a path or an alias.

Parameters:
Name Type Description
alias string

Path or alias

data *

Data to search

Source:

(static) getBody(source) → {object}

Returns the body from the Network Request. This is the the posted body. This is a fully parsed object..

Path is payload,body.

Parameters:
Name Type Description
source object

The Network Request instance

Source:

(static) getBodyKey(…path, source) → {*}

Returns the data using the specified path from the body of the Network Request.

Parameters:
Name Type Attributes Description
path string <repeatable>

key in object

source object

The Network Request instance

Source:

(static) getDomain(source) → {string}

Returns the domain from the Network Request. This is the the domain portion of the request URL..

Path is payload,location,domain.

Parameters:
Name Type Description
source object

The Network Request instance

Source:

(static) getHash(source) → {string}

Returns the hash from the Network Request. This is the the hash portion of the request URL..

Path is payload,location,hash.

Parameters:
Name Type Description
source object

The Network Request instance

Source:

(static) getHost(source) → {string}

Returns the host from the Network Request. This is the the host portion of the request URL. Includes port number.

Path is payload,location,host.

Parameters:
Name Type Description
source object

The Network Request instance

Source:

(static) getHostname(source) → {string}

Returns the hostname from the Network Request. This is the the host portion of the request URL without the port number..

Path is payload,location,hostname.

Parameters:
Name Type Description
source object

The Network Request instance

Source:

(static) getInitiator(source) → {string}

Returns the initiator from the Network Request. This is the the webpage that initiated the request..

Path is payload,initiator.

Parameters:
Name Type Description
source object

The Network Request instance

Source:

(static) getLocation(source) → {object}

Returns the location from the Network Request. This is the parsed information from the request URL..

Path is payload,location.

Parameters:
Name Type Description
source object

The Network Request instance

Source:

(static) getLocationKey(…path, source) → {*}

Returns the data using the specified path from the location of the Network Request.

Parameters:
Name Type Attributes Description
path string <repeatable>

key in object

source object

The Network Request instance

Source:

(static) getMethod(source) → {string}

Returns the method from the Network Request. This is the hTTP method that the request is made with..

Path is payload,method.

Parameters:
Name Type Description
source object

The Network Request instance

Source:

(static) getOrigin(source) → {string}

Returns the origin from the Network Request. This is the the origin portion of the request URL..

Path is payload,location,origin.

Parameters:
Name Type Description
source object

The Network Request instance

Source:

(static) getPath(source) → {string}

Returns the path from the Network Request. This is the the path of the request URL..

Path is payload,location,path.

Parameters:
Name Type Description
source object

The Network Request instance

Source:

(static) getPort(source) → {string}

Returns the port from the Network Request. This is the the port of the request URL..

Path is payload,location,port.

Parameters:
Name Type Description
source object

The Network Request instance

Source:

(static) getProtocol(source) → {string}

Returns the protocol from the Network Request. This is the the protocol portion of the request URL..

Path is payload,location,protocol.

Parameters:
Name Type Description
source object

The Network Request instance

Source:

(static) getQuery(source) → {string}

Returns the query from the Network Request. This is the the query string portion of the request URL..

Path is payload,location,query.

Parameters:
Name Type Description
source object

The Network Request instance

Source:

(static) getRequestId(source) → {string}

Returns the requestId from the Network Request. This is the iD that can be used to pair requests with responses..

Path is payload,requestId.

Parameters:
Name Type Description
source object

The Network Request instance

Source:

(static) getRootType(source) → {string}

Returns the rootType from the Network Request. This is the the type of event. For network requests it's always 'netreq'..

Path is type.

Parameters:
Name Type Description
source object

The Network Request instance

Source:

(static) getUrl(source) → {string}

Returns the url from the Network Request. This is the the URL the request is being made to. Contains the full host, path, and query string..

Path is payload,url.

Parameters:
Name Type Description
source object

The Network Request instance

Source:

(static) isMatch(source) → {boolean}

Tests the provided source against the matcher to see if it's Network Request event.

Parameters:
Name Type Description
source object

The Network Request instance

Source:
See:
  • kit.isMatch

(static) make(…input) → {object}

Generates a Network Request with the const values set. Can be useful in testing. Can provide additional data by providing a flat object of paths and values.

Parameters:
Name Type Attributes Description
input function <repeatable>

Overrides

Source:

(static) mock(…input) → {object}

Generates a Network Request with some default values set. Can be useful in testing. Can override defaults and provide additional data by providing a flat object of paths and values.

Parameters:
Name Type Attributes Description
input function <repeatable>

Overrides

Source: