Go中的ResolveReference时如何避免删除URL斜杠末尾
In the following example, end of URL /
is removed, is there a way to keep the /
?
package main
import (
"fmt"
"net/url"
"path"
)
func main() {
u, _ := url.Parse("http://localhost:5100")
relative, _ := url.Parse(path.Join("hello/"))
fmt.Println(u.ResolveReference(relative))
}
Output:
http://localhost:5100/hello
duannuochi3549
2014/04/14 03:08- path
- http
- url
- 点赞
- 收藏
- 回答
满意答案