我正在尝试解析 Go 中的 URL 并从 URL 获取主机和方案。但是,在解析带有端口且没有方案的 URL 时,我得到了意想不到的结果。
u, err := url.ParseRequestURI("hello.com:81")
fmt.Println("host :",u.Host)
fmt.Println("scheme :",u.Scheme)
我得到了意想不到的结果
host :
scheme: hello.com
我想要这个
host : hello.com:80
scheme:
www说
三国纷争
繁星淼淼
拉风的咖菲猫
随时随地看视频慕课网APP
相关分类