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
优先精确匹配path完全相同的api #326
Open
angular-moon
wants to merge
10
commits into
easy-mock:dev
Choose a base branch
from
angular-moon:dev
base: dev
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
优先精确匹配path完全相同的api #326
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@angular-moon 做了一个精确匹配的排序,你看看是否更合适
|
@SoyMeng 没太看懂, 你写的sort, 是不是写错了, tokens.length 不是都是2吗, 你是想比较url的长度吗? 需要优先匹配 |
@angular-moon 精确匹配根据匹配到的参数数量来判断优先级 所以匹配/api/foo/x更精确,这个方法不一定完善,但我认为如果需要扩展只需要在sort方法中做优化,至少比===更准确点 |
@SoyMeng thanks, 按照你的实现修改了 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
Does this PR introduce a breaking change?
If yes, please describe the impact and migration path for existing applications:
优先精确匹配path完全相同的api, 而不是api的定义顺序决定匹配优先级
The PR fulfills these requirements:
dev
branch, not themaster
branchOther information: