sanitizeBaseURL parses the the baseURL, and adds the "http" scheme if needed. If the URL is unparsable, the baseURL is returned unchanged.
(baseURL string)
| 635 | // sanitizeBaseURL parses the the baseURL, and adds the "http" scheme if needed. |
| 636 | // If the URL is unparsable, the baseURL is returned unchanged. |
| 637 | func sanitizeBaseURL(baseURL string) string { |
| 638 | u, err := url.Parse(baseURL) |
| 639 | if err != nil { |
| 640 | return baseURL // invalid URL will fail later when making requests |
| 641 | } |
| 642 | if u.Scheme == "" { |
| 643 | u.Scheme = "http" |
| 644 | } |
| 645 | return u.String() |
| 646 | } |
| 647 | |
| 648 | // baseServicePath composes the path prefix for the service (without <Method>). |
| 649 | // e.g.: baseServicePath("/twirp", "my.pkg", "MyService") |
no test coverage detected