let id = 2;
let userId, title, body;
cy.request({
method: "GET",
url: "https://jsonplaceholder.typicode.com/posts/",
qs: {
id: id
}
})
.then((response) => {
expect(response.status).to.eq(200)
userId = response.body[0].userId
id = response.body[0].id
title = response.body[0].title
body = response.body[0].body
cy.log(`userId: ${userId}, id: ${id}, title: ${title},
body: ${body}`)
})
let body = JSON.parse(response.body);
let userId = body[0].userId;