From 076b6cb95b7f52ea1cc9023f64f3405a85fc4b06 Mon Sep 17 00:00:00 2001 From: Jeongseup Date: Thu, 14 Dec 2023 15:36:48 +0900 Subject: [PATCH] Update temp --- td2/rpc.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/td2/rpc.go b/td2/rpc.go index 4e5863b..5f61687 100644 --- a/td2/rpc.go +++ b/td2/rpc.go @@ -272,7 +272,18 @@ func guessPublicEndpoint(u string) string { } func getStatusWithEndpoint(ctx context.Context, u string) (string, bool, error) { - queryPath := fmt.Sprintf("%s/status", u) + // Parse the URL + parsedURL, err := url.Parse(u) + if err != nil { + return "", false, err + } + + // Check if the scheme is 'tcp' and modify to 'http' + if parsedURL.Scheme == "tcp" { + parsedURL.Scheme = "http" + } + + queryPath := fmt.Sprintf("%s/status", parsedURL.String()) req, err := http.NewRequestWithContext(ctx, http.MethodGet, queryPath, nil) if err != nil { return "", false, err