mirror of
https://github.com/golang/go
synced 2024-11-18 15:54:42 -07:00
net/http/httptrace: fix bad tracing example
Tracing happens at the http.Trace level. Fix the example to demostrate tracing in the lifecycle of a RoundTrip. Updates #17152. Change-Id: Ic7d7bcc550176189206185482e8962dbf1504ff1 Reviewed-on: https://go-review.googlesource.com/29431 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
836a3ae663
commit
f964810025
@ -6,6 +6,7 @@ package httptrace_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/http/httptrace"
|
||||
)
|
||||
@ -21,5 +22,8 @@ func Example() {
|
||||
},
|
||||
}
|
||||
req = req.WithContext(httptrace.WithClientTrace(req.Context(), trace))
|
||||
http.DefaultClient.Do(req)
|
||||
_, err := http.DefaultTransport.RoundTrip(req)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user