DEV Community

Cover image for cypress - req.reply()
Vasudevan
Vasudevan

Posted on

cypress - req.reply()

cy.intercept({
method: 'GET',
url: 'https://rahulshettyacademy.com/Library/GetBook.php?AuthorName=shetty',
}, (req) => {
req.reply({
statusCode: 200,
body:{
"book_name": 'Modified Response book',
"isbn": "BSG",
"aisle": "2302"
}
});
}).as('bookRetrievals')

where am i going wrong here, i know i can use other ways.. but is this wrong way to use req.reply() or what am i missing .. i just want to stub with my response instead of original api response using reply()

Top comments (0)