20 lines
326 B
Go
20 lines
326 B
Go
|
package endpoint
|
||
|
|
||
|
import (
|
||
|
"net/url"
|
||
|
"strings"
|
||
|
)
|
||
|
|
||
|
func Make(baseUrl *url.URL, path string, vals ...url.Values) string {
|
||
|
var sb strings.Builder
|
||
|
sb.WriteString(baseUrl.String())
|
||
|
sb.WriteString("/")
|
||
|
sb.WriteString(path)
|
||
|
if len(vals) > 0 {
|
||
|
sb.WriteString("?")
|
||
|
sb.WriteString(vals[0].Encode())
|
||
|
}
|
||
|
return sb.String()
|
||
|
|
||
|
}
|