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 2 years ago
Updated 2 years 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.