Optional
aliasVerify if the given body is equal or unequal to the given response's body.
the response to check.
the body to check.
the result to check for.
true if the body equal/unequal as expected.
// json response
UseApi.as(actor).checkBody(response, { text: 'test' }, 'equal');
// text response
UseApi.as(actor).checkBody(response, 'test', 'unequal');
// buffer response
UseApi.as(actor).checkBody(response, Buffer.from('abc'), 'equal');
Verify if the reponse (including receiving body) was received within a given duration or not.
the response to check
expected duration (in milliseconds) not to be exceeded
the result to check for.
true if response was received within given duration, false otherwise
// check if response was received within 2s
UseApi.as(actor).checkDuration(response, 2000, 'lessOrEqual');
Verify if the given headers are included/excluded in the given response. (headers should be a subset of response.headers)
the response to check.
the headers to check.
the result to check for.
true if the headers are is included/excluded as expected.
// check only keys
UseApi.as(actor).checkHeaders(response, { contentType: undefined }, 'included');
// check key and value
UseApi.as(actor).checkHeaders(response, { contentType: 'application/json' }, 'excluded');
Verify if the given status is equal or unequal to the given response's status.
the response to check.
the status to check.
the result to check for.
true if the status is equal/unequal as expected.
UseApi.as(actor).checkStatus(response, 200, 'equal');
Send a HTTP request (GET, POST, PATCH, PUT, HEAD or DELETE) to the specified url. Headers and data can also be sent.
GET, POST, PATCH, PUT, HEAD or DELETE.
the full URL to the target.
Optional
headers: any(optional) the headers object.
Optional
responseFormat: ResponseBodyFormat(optional) specify the desired format the response body should be in.
Optional
data: any(optional) the data to be sent.
Promise
UseApi
.as(actor)
.sendRequest(
REQUEST_METHOD.POST,
'/items', { authorization: 'Bearer dfh.dasgeq65qg.eyjkhf' },
'json', { title: 'new item' });
Static
asStatic
usingGenerated using TypeDoc
Name with which the ability is identified internally on actor level.