Skip to content

Commit

Permalink
[docs] Note http.Request.WithContext() conflict. (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
elithrar committed Aug 17, 2016
1 parent 01ef6ff commit f81bcf7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Expand Up @@ -4,4 +4,7 @@ context

gorilla/context is a general purpose registry for global request variables.

> Note: gorilla/context, having been born well before `context.Context` existed, does not play well
> with the shallow copying of the request that [`http.Request.WithContext`](https://golang.org/pkg/net/http/#Request.WithContext) (added to net/http Go 1.7 onwards) performs. You should either use *just* gorilla/context, or moving forward, the new `http.Request.Context()`.
Read the full documentation here: http://www.gorillatoolkit.org/pkg/context
6 changes: 6 additions & 0 deletions doc.go
Expand Up @@ -5,6 +5,12 @@
/*
Package context stores values shared during a request lifetime.
> Note: gorilla/context, having been born well before `context.Context` existed,
does not play well > with the shallow copying of the request that
[`http.Request.WithContext`](https://golang.org/pkg/net/http/#Request.WithContext)
(added to net/http Go 1.7 onwards) performs. You should either use *just*
gorilla/context, or moving forward, the new `http.Request.Context()`.
For example, a router can set variables extracted from the URL and later
application handlers can access those values, or it can be used to store
sessions values to be saved at the end of a request. There are several
Expand Down

0 comments on commit f81bcf7

Please sign in to comment.