Complete the code to stub a GET request with a dynamic response.
cy.intercept('GET', '/api/users', [1]).as('getUsers')
The stub must provide a dynamic response body with status 200 and user data.
Complete the code to stub a POST request and return a custom response.
cy.intercept('POST', '/api/login', (req) => { req.reply({ [1] }) }).as('postLogin')
The stub should simulate a successful login with status 200 and a token in the body.
Fix the error in the stub to correctly delay the response by 2 seconds.
cy.intercept('GET', '/api/data', { [1] }).as('getData')
The correct property to delay response is delay with milliseconds.
Fill both blanks to stub a GET request that returns a 404 status with a custom error message.
cy.intercept('GET', '/api/item/[1]', { statusCode: [2], body: { error: 'Item not found' } }).as('getItem')
The URL uses a dynamic parameter :id and the status code for not found is 404.
Fill all three blanks to stub a PUT request that updates a user and returns the updated user data with status 200.
cy.intercept('PUT', '/api/users/[1]', (req) => { req.reply({ statusCode: [2], body: [3] }) }).as('updateUser')
The URL uses :userId as dynamic param, status 200 means success, and the body returns updated user data from the request.