make docs clearer

This commit is contained in:
Simon Larsen
2023-10-05 17:07:46 +01:00
parent 2c90d8c0be
commit b00ce0e894

View File

@@ -20,11 +20,21 @@ The following variables are available in the context of the monitored object:
The following example shows how to use a JavaScript expression to monitor a website for a specific string in the response body:
```javascript
/**
*
* If response body is in JSON then responseBody will be a JSON object
* {
* "item": "hello"
* }
*
* **/
"{{responseBody.item}}" === "hello"
// or you can use response headers
"{{responseHeaders.contentType}} === "text/html"
"{{responseHeaders.contentType}} === "application/json"
// you can also use regular expressions
@@ -41,6 +51,17 @@ The following example shows how to use a JavaScript expression to monitor a webs
// for arrays you can use the following
/**
*
* If response body is:
* {
* "item": [{
* "name": "hello"
* }]
* }
*
* **/
"{{responseBody.items[0].name}}" === "hello"
```