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

fix(core): matchers should be resetted after unsuccessful matching #46

Merged
merged 3 commits into from Jun 10, 2018

Conversation

Projects
2 participants
@JozefFlakus
Copy link
Member

commented Jun 8, 2018

PR Type

What kind of change does this PR introduce?

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

Example:

    const e1$: Effect = req$ => req$.pipe(
      matchPath('/test'),
      matchType('GET'),
      // ...
    );

    const e2$: Effect = req$ => req$.pipe(
      matchType('POST'),
      matchPath('/test'),
      // ...
    );

Lets say we have two endpoints which are listening for the same route but with different order of matchers for different methods (POST, GET). If we will send a POST /test the last endpoint won't be matched properly, but it should.

Issue Number: N/A

What is the new behavior?

  • After each unsuccessful matching (using matchType or matchPath) the dedicated matcherGuard should reset all matching points only when the request wasn't resolved previously. It will prevent any leftovers and matching conflicts.
  • renamed matcherFactory into matchPathFactory

Does this PR introduce a breaking change?

[ ] Yes
[x] No

@JozefFlakus JozefFlakus added the bug label Jun 8, 2018

@JozefFlakus JozefFlakus added this to the v0.4.2 milestone Jun 8, 2018

@JozefFlakus JozefFlakus added this to To do in Roadmap to 1.0.0 via automation Jun 8, 2018

@JozefFlakus JozefFlakus requested a review from marblejs/contributors Jun 8, 2018

@codecov

This comment has been minimized.

Copy link

commented Jun 8, 2018

Codecov Report

Merging #46 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #46   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          25     25           
  Lines         297    298    +1     
  Branches       36     35    -1     
=====================================
+ Hits          297    298    +1
Impacted Files Coverage Δ
.../core/src/operators/matchPath/matchPath.factory.ts 100% <100%> (ø)
...core/src/operators/matchType/matchType.operator.ts 100% <100%> (ø) ⬆️
.../core/src/operators/matchPath/urlParams.factory.ts 100% <100%> (ø) ⬆️
...core/src/operators/matchPath/matchPath.operator.ts 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5037059...a85d456. Read the comment docs.

@JozefFlakus JozefFlakus moved this from To do to In progress in Roadmap to 1.0.0 Jun 8, 2018

@JozefFlakus JozefFlakus merged commit 805ea19 into master Jun 10, 2018

2 checks passed

Travis CI - Pull Request Build Passed
Details
codecov/patch 100% of diff hit (target 100%)
Details

Roadmap to 1.0.0 automation moved this from In progress to Done Jun 10, 2018

@JozefFlakus JozefFlakus deleted the feature/combineRoutesMiddleware branch Jun 10, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.