Prevent Response Caching in Cypress by Deleting 'if-none-match' Request Header

Filip Hric
InstructorFilip Hric

Share this video with your friends

Send Tweet
Published 3 months ago
Updated 3 months ago

Servers sometimes use entity tags that identify a user and provide them with a cached response if needed. This can create ambiguity in your tests. To make your tests more stable, you can modify the request headers that take care of this caching. By deleting if-none-match header with .intercept() command, you will get a fresh response from server every time.