Type Definitions
JsonPrimitive
- Source:
Valid JSON primitive types.
Type:
- string | number | boolean | null | Array.<JsonPrimitive> | Object.<string, (JsonPrimitive|undefined)>
DynamicResponseModFn(request, response, queryParamMap) → {JsonPrimitive}
- Source:
Function to generate mock responses dynamically.
Returned responses will be saved and passed as the `request` in subsequent calls.
Parameters:
Name | Type | Description |
---|---|---|
request |
JsonPrimitive | Payload/body passed in the network request. |
response |
JsonPrimitive | Response object returned by the previous network call and modified by this same function. |
queryParamMap |
Object.<string, string> | Key-value map of query parameters from the request URL. Hash content will be stored in 'hash' key. |
Returns:
Dynamic response; will be saved for subsequent calls.
- Type
- JsonPrimitive
MockResponseConfig
- Source:
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
response |
JsonPrimitive |
<optional> |
null
|
Mock response to be returned. If `dynamicResponseModFn` is defined, the value defined here will be the first `response` argument passed into the function. |
dynamicResponseModFn |
DynamicResponseModFn |
<optional> |
null
|
Function to dynamically change the response object based on each request's contents. |
delay |
number |
<optional> |
0
|
Optional network mock resolution time. |
usePathnameForAllQueries |
boolean |
<optional> |
false
|
Optional flag to treat all URLs with the same pathname identically. |
responseProperties |
Object |
<optional> |
{}
|
Custom properties to add to the mock response, e.g. `headers` object. |
Mock configuration for a single URL.
Type:
- Object