examples/client: Add optional host argument

This commit is contained in:
adnano 2020-09-28 16:13:14 -04:00
parent 4c0b13fb57
commit 684bb1cc68

View File

@ -152,8 +152,19 @@ func main() {
os.Exit(1)
}
var host string
if len(os.Args) >= 3 {
host = os.Args[2]
}
url := os.Args[1]
req, err := gmi.NewRequest(url)
var req *gmi.Request
var err error
if host != "" {
req, err = gmi.NewRequestTo(url, host)
} else {
req, err = gmi.NewRequest(url)
}
if err != nil {
fmt.Println(err)
os.Exit(1)