How to regex match method in intercept? #14970
Answered
by
jennifer-shehane
aleksandar-b
asked this question in
Questions and Help
-
I want to intercept all requests that are not method OPTIONS. cy.intercept({ url: '', method: /^((?!options).)$/, headers: { 'content-type': 'application/json' } }).as('submit'); |
Beta Was this translation helpful? Give feedback.
Answered by
jennifer-shehane
Feb 9, 2021
Replies: 1 comment
-
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
aleksandar-b
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
method
accepts a RegExp arguments, so any regex that is passed that does not match options should work. Try using https://regex101.com/ to come up with an appropriate RegExp.