Commit f9648100 authored by Jaana Burcu Dogan's avatar Jaana Burcu Dogan

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/29431Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 836a3ae6
......@@ -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)
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment