1
0
mirror of https://github.com/golang/go synced 2024-09-30 19:28:32 -06: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:
Jaana Burcu Dogan 2016-09-19 20:36:45 -07:00
parent 836a3ae663
commit f964810025

View File

@ -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)
}
}