transport/http: PopulateRequestContext Accept
Add the request Accept header to the context,
under the ContextKeyRequestAccept key.
Closes #515.
Peter Bourgon
6 years ago
59 | 59 | ContextKeyRequestReferer: r.Header.Get("Referer"), |
60 | 60 | ContextKeyRequestUserAgent: r.Header.Get("User-Agent"), |
61 | 61 | ContextKeyRequestXRequestID: r.Header.Get("X-Request-Id"), |
62 | ContextKeyRequestAccept: r.Header.Get("Accept"), | |
62 | 63 | } { |
63 | 64 | ctx = context.WithValue(ctx, k, v) |
64 | 65 | } |
116 | 117 | // PopulateRequestContext. Its value is r.Header.Get("X-Request-Id"). |
117 | 118 | ContextKeyRequestXRequestID |
118 | 119 | |
120 | // ContextKeyRequestAccept is populated in the context by | |
121 | // PopulateRequestContext. Its value is r.Header.Get("Accept"). | |
122 | ContextKeyRequestAccept | |
123 | ||
119 | 124 | // ContextKeyResponseHeaders is populated in the context whenever a |
120 | 125 | // ServerFinalizerFunc is specified. Its value is of type http.Header, and |
121 | 126 | // is captured only once the entire response has been written. |