Merge pull request #515 from coseyo/bugfix_path

fix api path contain regex string bug
This commit is contained in:
astaxie 2018-04-20 16:52:15 +08:00 committed by GitHub
commit 5c1ee91097
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -1263,6 +1263,12 @@ func urlReplace(src string) string {
} else if p[0] == '?' && p[1] == ':' {
pt[i] = "{" + p[2:] + "}"
}
if pt[i][0] == '{' && strings.Contains(pt[i], ":") {
pt[i] = pt[i][:strings.Index(pt[i], ":")] + "}"
} else if pt[i][0] == '{' && strings.Contains(pt[i], "(") {
pt[i] = pt[i][:strings.Index(pt[i], "(")] + "}"
}
}
}
return strings.Join(pt, "/")