bugfix: trim relative slash incorrectly in apiBuilder.Party

Former-commit-id: 9c41facfe3b99138e80de6f12f6fea191e53cf60
This commit is contained in:
sy264115809 2017-08-23 11:14:16 +08:00
parent 1ffe4479f7
commit e466765842

View File

@ -214,8 +214,8 @@ func (api *APIBuilder) Party(relativePath string, handlers ...context.Handler) P
} }
// this is checked later on but for easier debug is better to do it here: // this is checked later on but for easier debug is better to do it here:
if api.relativePath[0] == '/' && relativePath[0] == '/' { if api.relativePath[len(api.relativePath)-1] == '/' && relativePath[0] == '/' {
parentPath = parentPath[1:] // remove first slash if parent ended with / and new one started with /. relativePath = relativePath[1:] // remove first slash if parent ended with / and new one started with /.
} }
// if it's subdomain then it has priority, i.e: // if it's subdomain then it has priority, i.e: