Skip to content

Commit

Permalink
Optimize the logic of obtaining the mock parameter value of the corre…
Browse files Browse the repository at this point in the history
…sponding method in the MockInvoker#invoke method (#7840)
  • Loading branch information
BurningCN committed May 23, 2021
1 parent 18c1bd5 commit 0049c24
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,8 @@ public Result invoke(Invocation invocation) throws RpcException {
if (invocation instanceof RpcInvocation) {
((RpcInvocation) invocation).setInvoker(this);
}
String mock = null;
if (getUrl().hasMethodParameter(invocation.getMethodName())) {
mock = getUrl().getParameter(invocation.getMethodName() + "." + MOCK_KEY);
}
if (StringUtils.isBlank(mock)) {
mock = getUrl().getParameter(MOCK_KEY);
}

String mock = getUrl().getMethodParameter(invocation.getMethodName(),MOCK_KEY);

if (StringUtils.isBlank(mock)) {
throw new RpcException(new IllegalAccessException("mock can not be null. url :" + url));
Expand Down

0 comments on commit 0049c24

Please sign in to comment.