Skip to content

Commit f81bcf7

Browse files
authored
[docs] Note http.Request.WithContext() conflict. (#33)
1 parent 01ef6ff commit f81bcf7

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,7 @@ context
44

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

7+
> Note: gorilla/context, having been born well before `context.Context` existed, does not play well
8+
> 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()`.
9+
710
Read the full documentation here: http://www.gorillatoolkit.org/pkg/context

doc.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
/*
66
Package context stores values shared during a request lifetime.
77
8+
> Note: gorilla/context, having been born well before `context.Context` existed,
9+
does not play well > with the shallow copying of the request that
10+
[`http.Request.WithContext`](https://golang.org/pkg/net/http/#Request.WithContext)
11+
(added to net/http Go 1.7 onwards) performs. You should either use *just*
12+
gorilla/context, or moving forward, the new `http.Request.Context()`.
13+
814
For example, a router can set variables extracted from the URL and later
915
application handlers can access those values, or it can be used to store
1016
sessions values to be saved at the end of a request. There are several

0 commit comments

Comments
 (0)