Skip to content

Does cy.intercept provide the ability to _not_ send the request to the destination server? #9320

Discussion options

You must be logged in to vote

👍 I think I've tracked it down, by looking through the examples - I had to update the code to call req.reply and to use res.send to ensure the request doesn't appear in the network tab full stop:

	const interceptor = (request) => {
		request.reply(({ send }) => fetchMock(request).then(send));
	};

	cy.intercept(
		"POST",
		`https://${Cypress.env("RANGER_API_SERVICE_DOMAIN")}/query`,
		interceptor,
	);

In which case I think this discussion can be closed, although I would say the documentation was pretty confusing and unhelpful for this case 👐

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@andycarrell
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by jennifer-shehane
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants