Skip to content

Commit a7fba15

Browse files
Revert "perf(transport/http): optimize URL construction with url.URL for bett…" (#3722)
1 parent 20de382 commit a7fba15

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

transport/http/client.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"fmt"
88
"io"
99
"net/http"
10-
"net/url"
1110
"time"
1211

1312
"github.com/go-kratos/kratos/v2/encoding"
@@ -227,12 +226,8 @@ func (client *Client) Invoke(ctx context.Context, method, path string, args any,
227226
contentType = c.contentType
228227
body = bytes.NewReader(data)
229228
}
230-
u := url.URL{
231-
Scheme: client.target.Scheme,
232-
Host: client.target.Authority,
233-
Path: path,
234-
}
235-
req, err := http.NewRequest(method, u.String(), body)
229+
url := fmt.Sprintf("%s://%s%s", client.target.Scheme, client.target.Authority, path)
230+
req, err := http.NewRequest(method, url, body)
236231
if err != nil {
237232
return err
238233
}

0 commit comments

Comments
 (0)