Skip to content
Snippets Groups Projects
Commit a48b9edc authored by william feng's avatar william feng
Browse files

reduce cognitive in base_directory.go

parent 248314af
No related branches found
No related tags found
No related merge requests found
......@@ -116,14 +116,11 @@ func (dir *BaseDirectory) isProperRouter(url *common.URL) bool {
if serviceKey == "" {
serviceKey = dir.GetUrl().SubURL.ServiceKey()
}
if len(app) > 0 {
if app != dir.GetUrl().GetParam(constant.APPLICATION_KEY, "") {
return false
}
} else {
if url.ServiceKey() != serviceKey {
return false
}
if len(app) > 0 && app != dir.GetUrl().GetParam(constant.APPLICATION_KEY, "") {
return false
}
if url.ServiceKey() != serviceKey {
return false
}
return true
}
......
......@@ -117,13 +117,11 @@ func NewConditionRouter(url *common.URL) (*ConditionRouter, error) {
}
router.url = url
var defaultPriority int64
var defaultPriority int64 = 0
if url.GetParam(constant.APPLICATION_KEY, "") != "" {
defaultPriority = 150
} else if url.GetParam(constant.INTERFACE_KEY, "") != "" {
defaultPriority = 140
} else {
defaultPriority = 0
}
router.priority = url.GetParamInt(constant.RouterPriority, defaultPriority)
router.Force = url.GetParamBool(constant.RouterForce, false)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment