Fix client example

This commit is contained in:
adnano
2020-09-24 01:43:03 -04:00
parent c6802d9d9a
commit fde295cb25
2 changed files with 11 additions and 2 deletions

View File

@@ -99,13 +99,21 @@ func NewRequest(rawurl string) (*Request, error) {
return nil, err
}
host := u.Host
// If there is no port, use the default port of 1965
if u.Port() == "" {
host += ":1965"
}
return &Request{
Host: u.Host,
Host: host,
URL: u,
}, nil
}
// NewProxyRequest returns a new request using the provided host.
// The provided host must contain a port.
func NewProxyRequest(host, rawurl string) (*Request, error) {
u, err := url.Parse(rawurl)
if err != nil {