1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-10-30 23:47:59 +02:00

Revert "perf(transport/http): optimize URL construction with url.URL for bett…" (#3722)

This commit is contained in:
包子
2025-09-12 18:33:08 +08:00
committed by GitHub
parent 20de382718
commit a7fba153b8

View File

@@ -7,7 +7,6 @@ import (
"fmt"
"io"
"net/http"
"net/url"
"time"
"github.com/go-kratos/kratos/v2/encoding"
@@ -227,12 +226,8 @@ func (client *Client) Invoke(ctx context.Context, method, path string, args any,
contentType = c.contentType
body = bytes.NewReader(data)
}
u := url.URL{
Scheme: client.target.Scheme,
Host: client.target.Authority,
Path: path,
}
req, err := http.NewRequest(method, u.String(), body)
url := fmt.Sprintf("%s://%s%s", client.target.Scheme, client.target.Authority, path)
req, err := http.NewRequest(method, url, body)
if err != nil {
return err
}