networkResponse

networkResponse

Contains constants and functions for a Network Response.

The structure for a Network Response is as follows:

{
  payload: {
    fromCache: <boolean>,
    initiator: <string>,
    ip: <string>,
    location: {
      domain: <string>,
      hash: <string>,
      host: <string>,
      hostname: <string>,
      origin: <string>,
      path: <string>,
      port: <string>,
      protocol: <string>,
      query: <string>,
    },
    method: <string>,
    responseHeaders: <object>,
    requestId: <string>,
    statusCode: <integer>,
    statusLine: <string>,
    url: <string>,
  },
  type: 'netres'
  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 Response 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 Response

Properties:
Name Type Description
payload string

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

fromCache string

Whether the data was loaded from the browser cache..
Path is payload.fromCache.

initiator string

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

ip string

The ip address of the server..
Path is payload.ip.

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.

responseHeaders string

The headers returned from the server..
Path is payload.responseHeaders.

requestId string

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

statusCode string

The resulting status code of the request..
Path is payload.statusCode.

statusLine string

More details about the status of the request..
Path is payload.statusLine.

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 responses it's always 'netres'..
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 Response.

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) getDomain(source) → {string}

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

Path is payload,location,domain.

Parameters:
Name Type Description
source object

The Network Response instance

Source:

(static) getFromCache(source) → {boolean}

Returns the fromCache from the Network Response. This is the whether the data was loaded from the browser cache..

Path is payload,fromCache.

Parameters:
Name Type Description
source object

The Network Response instance

Source:

(static) getHash(source) → {string}

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

Path is payload,location,hash.

Parameters:
Name Type Description
source object

The Network Response instance

Source:

(static) getHost(source) → {string}

Returns the host from the Network Response. 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 Response instance

Source:

(static) getHostname(source) → {string}

Returns the hostname from the Network Response. 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 Response instance

Source:

(static) getInitiator(source) → {string}

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

Path is payload,initiator.

Parameters:
Name Type Description
source object

The Network Response instance

Source:

(static) getIp(source) → {string}

Returns the ip from the Network Response. This is the the ip address of the server..

Path is payload,ip.

Parameters:
Name Type Description
source object

The Network Response instance

Source:

(static) getLocation(source) → {object}

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

Path is payload,location.

Parameters:
Name Type Description
source object

The Network Response instance

Source:

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

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

Parameters:
Name Type Attributes Description
path string <repeatable>

key in object

source object

The Network Response instance

Source:

(static) getMethod(source) → {string}

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

Path is payload,method.

Parameters:
Name Type Description
source object

The Network Response instance

Source:

(static) getOrigin(source) → {string}

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

Path is payload,location,origin.

Parameters:
Name Type Description
source object

The Network Response instance

Source:

(static) getPath(source) → {string}

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

Path is payload,location,path.

Parameters:
Name Type Description
source object

The Network Response instance

Source:

(static) getPort(source) → {string}

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

Path is payload,location,port.

Parameters:
Name Type Description
source object

The Network Response instance

Source:

(static) getProtocol(source) → {string}

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

Path is payload,location,protocol.

Parameters:
Name Type Description
source object

The Network Response instance

Source:

(static) getQuery(source) → {string}

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

Path is payload,location,query.

Parameters:
Name Type Description
source object

The Network Response instance

Source:

(static) getRequestId(source) → {string}

Returns the requestId from the Network Response. 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 Response instance

Source:

(static) getResponseHeaders(source) → {object}

Returns the responseHeaders from the Network Response. This is the the headers returned from the server..

Path is payload,responseHeaders.

Parameters:
Name Type Description
source object

The Network Response instance

Source:

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

Returns the data using the specified path from the responseHeaders of the Network Response.

Parameters:
Name Type Attributes Description
path string <repeatable>

key in object

source object

The Network Response instance

Source:

(static) getRootType(source) → {string}

Returns the rootType from the Network Response. This is the the type of event. For network responses it's always 'netres'..

Path is type.

Parameters:
Name Type Description
source object

The Network Response instance

Source:

(static) getStatusCode(source) → {number}

Returns the statusCode from the Network Response. This is the the resulting status code of the request..

Path is payload,statusCode.

Parameters:
Name Type Description
source object

The Network Response instance

Source:

(static) getStatusLine(source) → {string}

Returns the statusLine from the Network Response. This is the more details about the status of the request..

Path is payload,statusLine.

Parameters:
Name Type Description
source object

The Network Response instance

Source:

(static) getUrl(source) → {string}

Returns the url from the Network Response. 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 Response instance

Source:

(static) isMatch(source) → {boolean}

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

Parameters:
Name Type Description
source object

The Network Response instance

Source:
See:
  • kit.isMatch

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

Generates a Network Response 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 Response 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: