1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-11-06 08:59:18 +02:00

feat: add http transport interface (#1533)

feat: add http transport interface
This commit is contained in:
longxboy
2021-10-08 11:10:21 +08:00
committed by GitHub
parent a99659052a
commit 056812e4b2
2 changed files with 10 additions and 3 deletions

View File

@@ -26,7 +26,7 @@ func setClientSpan(ctx context.Context, span trace.Span, m interface{}) {
operation = tr.Operation()
rpcKind = tr.Kind().String()
if tr.Kind() == transport.KindHTTP {
if ht, ok := tr.(*http.Transport); ok {
if ht, ok := tr.(http.Transporter); ok {
method := ht.Request().Method
route := ht.PathTemplate()
path := ht.Request().URL.Path
@@ -61,7 +61,7 @@ func setServerSpan(ctx context.Context, span trace.Span, m interface{}) {
operation = tr.Operation()
rpcKind = tr.Kind().String()
if tr.Kind() == transport.KindHTTP {
if ht, ok := tr.(*http.Transport); ok {
if ht, ok := tr.(http.Transporter); ok {
method := ht.Request().Method
route := ht.PathTemplate()
path := ht.Request().URL.Path