Skip to content

mock.config里面的普通匹配不是按最大长度匹配的 #123

@solosky

Description

@solosky

mock.config

var serverBase="http://localhost:8080";
module.exports = {
   "/user/queryId": serverBase +  "/user/queryId",
  "/user/queryIdByName": serverBase + "/user/queryIdByName"
};

UserController

  @RequestMapping("queryId")
    @ResponseBody
    public String queryUserId(){
        return "queryUserId";
    }

    @RequestMapping("queryIdByName")
    @ResponseBody
    public String queryUserName(){
        return "queryUserIdByName";
    }
}

如果请求 fekit的mock服务器路径/user/queryIdByName,fekit的mock服务器会请求代理服务器路径/user/queryId,原因是mock服务的实现的逻辑是优先找到第一个前缀匹配的。(请忽略例子的合理性)

但J2EE和Spring的实现都是要求最长匹配的,即找到所有可匹配项的最长匹配来作为最终代理的路径,希望Fekit也能遵守这个规范。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions