ing
This commit is contained in:
parent
653262bd7e
commit
2f57a0975f
20
net/url/url.go
Normal file
20
net/url/url.go
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
package url
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/url"
|
||||||
|
"path"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Join is concat URL string and path
|
||||||
|
// ex) http://127.0.0.1/ and /entry
|
||||||
|
func Join(u string, p string) (string, error) {
|
||||||
|
var err error
|
||||||
|
var rURL *url.URL
|
||||||
|
|
||||||
|
if rURL, err = url.Parse(u); nil != err {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
rURL.Path = path.Join(rURL.Path, p)
|
||||||
|
return rURL.String(), nil
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user