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

feat: allow wildcard in mock paths #3713

Merged
merged 1 commit into from
Jun 1, 2021

Conversation

mdrichardson
Copy link
Contributor

@mdrichardson mdrichardson commented May 27, 2021

Fixes #3712

Description

See linked issue for more details, but this is for parity w/ .NET.

Specific Changes

Allow wildcards in URL paths by replacing the path with a RegExp and replacing * with .*.

Testing

Changed 1 test, which passes. Others will change as part of another PR.

image

@mdrichardson mdrichardson added the Area: Adaptive The issue is related to Adaptive dialogs label May 27, 2021
@mdrichardson mdrichardson requested review from a team as code owners May 27, 2021 19:04
@mdrichardson mdrichardson requested review from Stevenic and chrimc62 May 27, 2021 19:04
path = path.startsWith('/') ? path : '/' + path;
if (path.includes('*')) {
// eslint-disable-next-line security/detect-non-literal-regexp
Copy link
Contributor Author

@mdrichardson mdrichardson May 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: This security check is for DoS attacks, which I don't believe is a concern, given how this is used in a test library for mocks.

@mdrichardson mdrichardson changed the title parity: allow wildcard in mock paths feat: allow wildcard in mock paths May 27, 2021
@coveralls
Copy link

coveralls commented May 27, 2021

Pull Request Test Coverage Report for Build 883257126

  • 3 of 3 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.001%) to 85.339%

Totals Coverage Status
Change from base Build 880156016: -0.001%
Covered Lines: 19235
Relevant Lines: 21435

💛 - Coveralls

@mdrichardson mdrichardson merged commit c9564c1 into microsoft:main Jun 1, 2021
@mdrichardson mdrichardson deleted the wildcardPaths branch June 1, 2021 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Adaptive The issue is related to Adaptive dialogs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

httpRequestSequenceMock doesn't allow wildcard paths
3 participants