I am trying to pass the result of an API request using the following function:
Add(someName) {
cy.request ({
method: 'POST',
url: someURL,
body: {
name: someName
}
}).then(function(response){
return response
})
}
When I try to call this function however, it does not give me the content of the response (it gives me Undefined). I thought this probably has something to do with either asynchronosity (if that is a word),or the scope of the object and therefore tried aliasing the response or defining an object outside of the function (then assigning the response to that object), without any luck.