Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add regex option to ResponseMatcher #109

Merged
merged 2 commits into from
Apr 3, 2023
Merged

Add regex option to ResponseMatcher #109

merged 2 commits into from
Apr 3, 2023

Conversation

MindPatch
Copy link
Contributor

This PR adds the ability to use regular expressions when matching a response body in the ResponseMatcher struct. The new ResponseMatcher options are multi_line, case_insensitive, ignore_whitespace, unicode, octal, and dot_matches_new_line. These options can be passed in using a Lua table when creating a ResponseMatcher object, or can be set using the options method.

The commit also includes modifications to the ResponseMatcher implementation to enable regex matching. A new is_regex parameter is added to the match_and_body method to indicate whether a regex pattern should be used for matching. The method now builds a Regex object using the provided regex pattern and the new ResponseMatcher options, and then checks whether the pattern matches the provided response body.

Finally, this commit includes updates to the UtilsEXT implementation to set default options for the ResponseMatcher object when creating it in the Lua runtime.

@MindPatch MindPatch merged commit 3e58e1a into 0.5-beta Apr 3, 2023
@MindPatch MindPatch deleted the extract_regex branch April 3, 2023 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant