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

Simplifying the use of regular expressions #7

Open
amitguptagwl opened this issue Jun 26, 2018 · 0 comments
Open

Simplifying the use of regular expressions #7

amitguptagwl opened this issue Jun 26, 2018 · 0 comments
Labels
enhancement first-timers-only Suitable for fevelopers who are contributing first time in open source development . good first issue small win, trivial, less complex issues. Created to encourage Open Source development help wanted

Comments

@amitguptagwl
Copy link
Member

Why

In current version of Stubmatic, we use regular expressions to match & catch HTTP request. Writing regular expression can be an easy task for a developer, but reading and understanding it later is complex.

What

To solve this we're planning to use named regular expressions. E.g.

\authorize\(admin|staff|user)

can be replaced with

\authorize\:role:

How

  1. Create a set of regular expressions a project may need. Save them in a file
role : (admin|staff|user)
  1. Load this file when the Stubmatic starts before loading the mappings
  2. Replace each named regular expression with actual regular expression in mapping loaded into the memory.
@amitguptagwl amitguptagwl added enhancement help wanted good first issue small win, trivial, less complex issues. Created to encourage Open Source development first-timers-only Suitable for fevelopers who are contributing first time in open source development . labels Jun 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement first-timers-only Suitable for fevelopers who are contributing first time in open source development . good first issue small win, trivial, less complex issues. Created to encourage Open Source development help wanted
Projects
None yet
Development

No branches or pull requests

1 participant