ZAP- Assigning response.body to a variable

2 views
Skip to first unread message

Varun Sharma

unread,
Feb 16, 2016, 3:54:41 PM2/16/16
to mozilla-zest
Hi,

I want to assign the whole response body to a variable using Zest in ZAP.

Assigning part of response.body to a variable was easy but i cant get to assign whole of the response.body to a variable. Any help will be highly appreciated.

Thanks!

thc...@gmail.com

unread,
Nov 20, 2017, 6:29:57 PM11/20/17
to mozill...@googlegroups.com
Hi.

(I know this is already too late, but just in case it's needed by anyone
else.)


That can be done by assigning the value of the "response.body" variable
(i.e. "{{response.body}}") to the variable you want, for example:

{
"prefix": "",
"type": "StandAlone",
"parameters": {
"tokenStart": "{{",
"tokenEnd": "}}",
"tokens": {},
"elementType": "ZestVariables"
},
"statements": [
{
"url": "http://example.com/",
"data": "",
"method": "GET",
"headers": "",
"assertions": [],
"followRedirects": false,
"cookies": [],
"index": 1,
"enabled": true,
"elementType": "ZestRequest"
},
{
"string": "{{response.body}}",
"variableName": "var",
"index": 2,
"enabled": true,
"elementType": "ZestAssignString"
},
{
"message": "{{var}}",
"index": 3,
"enabled": true,
"elementType": "ZestActionPrint"
}
],
"authentication": [],
"index": 0,
"enabled": true,
"elementType": "ZestScript"
}


Best regards.

On 16/02/16 20:54, Varun Sharma wrote:
> Hi,
>
> I want to assign the whole response body to a variable using Zest in ZAP.
>
> Assigning part of *response.body* to a variable was easy but i cant get to
> assign whole of the *response.body* to a variable. Any help will be highly
> appreciated.
>
> Thanks!
>
Reply all
Reply to author
Forward
0 new messages