Rename NewProxyRequest to NewRequestTo

This commit is contained in:
adnano 2020-09-27 20:37:16 -04:00
parent f6be76f8b8
commit 370bcf3bb9
2 changed files with 5 additions and 5 deletions

View File

@ -51,7 +51,7 @@ func (r *Request) Hostname() string {
return hostname(r.Host) return hostname(r.Host)
} }
// NewRequest returns a new request. The host is inferred from the provided url. // NewRequest returns a new request. The host is inferred from the provided URL.
func NewRequest(rawurl string) (*Request, error) { func NewRequest(rawurl string) (*Request, error) {
u, err := url.Parse(rawurl) u, err := url.Parse(rawurl)
if err != nil { if err != nil {
@ -71,9 +71,9 @@ func NewRequest(rawurl string) (*Request, error) {
}, nil }, nil
} }
// NewProxyRequest returns a new request using the provided host. // NewRequestTo returns a new request for the provided URL to the provided host.
// The provided host must contain a port. // The host must contain a port.
func NewProxyRequest(host, rawurl string) (*Request, error) { func NewRequestTo(rawurl, host string) (*Request, error) {
u, err := url.Parse(rawurl) u, err := url.Parse(rawurl)
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -66,7 +66,7 @@ func sendRequest(req *gmi.Request) error {
case gmi.StatusClassRedirect: case gmi.StatusClassRedirect:
fmt.Println("Redirecting to", resp.Meta) fmt.Println("Redirecting to", resp.Meta)
// Make the request to the same host // Make the request to the same host
red, err := gmi.NewProxyRequest(req.Host, resp.Meta) red, err := gmi.NewRequestTo(req.Host, resp.Meta)
if err != nil { if err != nil {
return err return err
} }