You can include response body in analytics by using the setResponseBody()
function.
Compatibility
Requires Node.js agent version 1.5.4 or higher.
Syntax
atatus.setResponseBody(value)
Parameter
Parameter | Type | Description |
---|---|---|
value | Object/String (Required) | Response body can have any value in object or string. |
Example
copy
import atatus from "atatus-nodejs";
atatus.setResponseBody({
"name": "Make it big",
"path": "/api/users/1",
"plan": "Premium",
"limit": 476189,
"timestamps": {
"created_at": "2022-06-08T19:29:36.513+00:00",
"updated_at": "2022-06-28T17:42:12.513+00:00"
}
})
copy
import atatus from "atatus-nodejs";
atatus.setResponseBody(`{
"product": "Laptop",
"price": 199,
"features": ["ssd", "touch_id", "gpu"],
}`)