mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
make docs clearer
This commit is contained in:
@@ -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"
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user