How to get request body using a groovy script in ReadyAPI
Hi,
The request (getDrafts) I'm testing takes a list of periods and reply with a list of data for those periods.
Request body:
{
"periods" : ["202101","202102"]
}
Response body:
{
"drafts" : [
{
"period" : "202101",
"data" : {
"name" : "Kalle Kula",
"epost" : "kalle@kula.se"
}
},
{
"period" : "202102",
"data" : {
"name" : "Krille Krokodil",
"phone" : "9876543210"
}
}
]
}
I would like to create a script that reads the requested periods from the request body, and for each value verifies that there is an item for that period in the response body. I also want to verify the content of the data-part for each item but first things first π
The problem is I cannot figure out how to get the contents of the request body from my groovy script.
Kind regards,
CamillaR