Commit 8b03a399 authored by Kevin Gillette's avatar Kevin Gillette Committed by Brad Fitzpatrick

net/http: make docs refer to Context.Value as a getter instead of context.WithValue

The doc comments of both ServerContextKey and LocalAddrContextKey both suggest that context.WithValue can be used to access (get) properties of the server or connection. This PR fixes those comments to refer to Context.Value instead.

Change-Id: I4ed383ef97ba1951f90c555243007469cfc18d4d
GitHub-Last-Rev: 05bc3acf82322e3dc77abc7fa0412efe01a77eac
GitHub-Pull-Request: golang/go#33833
Reviewed-on: https://go-review.googlesource.com/c/go/+/191838Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 78f6856d
...@@ -231,13 +231,13 @@ type CloseNotifier interface { ...@@ -231,13 +231,13 @@ type CloseNotifier interface {
var ( var (
// ServerContextKey is a context key. It can be used in HTTP // ServerContextKey is a context key. It can be used in HTTP
// handlers with context.WithValue to access the server that // handlers with Context.Value to access the server that
// started the handler. The associated value will be of // started the handler. The associated value will be of
// type *Server. // type *Server.
ServerContextKey = &contextKey{"http-server"} ServerContextKey = &contextKey{"http-server"}
// LocalAddrContextKey is a context key. It can be used in // LocalAddrContextKey is a context key. It can be used in
// HTTP handlers with context.WithValue to access the local // HTTP handlers with Context.Value to access the local
// address the connection arrived on. // address the connection arrived on.
// The associated value will be of type net.Addr. // The associated value will be of type net.Addr.
LocalAddrContextKey = &contextKey{"local-addr"} LocalAddrContextKey = &contextKey{"local-addr"}
......
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