getRequestHost returns the host of the http.Request.
(r *http.Request)
| 425 | |
| 426 | // getRequestHost returns the host of the http.Request. |
| 427 | func getRequestHost(r *http.Request) (string, error) { |
| 428 | if r.Host != "" { |
| 429 | return r.Host, nil |
| 430 | } |
| 431 | if r.URL != nil { |
| 432 | return r.URL.Host, nil |
| 433 | } |
| 434 | return "", errors.New("host not set in incoming request") |
| 435 | } |