Complete the code to stub a GET request to '/api/data' with a 200 status.
cy.intercept('GET', '/api/data', { statusCode: [1] }).as('getData')
The status code 200 means the request was successful, so it is the correct code to stub a successful GET request.
Complete the code to stub a POST request to '/api/login' and return a JSON object with a token.
cy.intercept('POST', '/api/login', { body: [1] }).as('postLogin')
The stub should return a JSON object with a token to simulate a successful login response.
Fix the error in the code to stub a GET request to '/api/items' and delay the response by 500ms.
cy.intercept('GET', '/api/items', { [1]: 500 }).as('getItems')
The correct property to delay a stubbed response in Cypress is 'delay'.
Fill both blanks to stub a PUT request to '/api/user' returning a 204 status and no body.
cy.intercept('PUT', '/api/user', { statusCode: [1], body: [2] }).as('putUser')
Status code 204 means no content, so the body should be null to indicate no response body.
Fill all three blanks to stub a DELETE request to '/api/item/123' that returns a 200 status, a JSON message, and delays response by 300ms.
cy.intercept('DELETE', '/api/item/123', { statusCode: [1], body: [2], [3]: 300 }).as('deleteItem')
The status code for a successful DELETE is 200 (A), the body is the JSON message (B), and the property for delaying the response is 'delay' (C).