File tree Expand file tree Collapse file tree 1 file changed +1
-20
lines changed Expand file tree Collapse file tree 1 file changed +1
-20
lines changed Original file line number Diff line number Diff line change @@ -34,28 +34,9 @@ func NewHandler(i resource.Index) (*Handler, error) {
34
34
return & Handler {schema : s }, nil
35
35
}
36
36
37
- // getContext creates a context for the request to add net/context support when used as a
38
- // standard http.Handler, without net/context support. The context will automatically be
39
- // canceled as soon as passed request connection will be closed.
40
- func getContext (w http.ResponseWriter , r * http.Request ) context.Context {
41
- ctx , cancel := context .WithCancel (context .Background ())
42
- // Handle canceled requests using net/context by passing a context
43
- // to the request handler that will be canceled as soon as the client
44
- // connection is closed
45
- if wcn , ok := w .(http.CloseNotifier ); ok {
46
- notify := wcn .CloseNotify ()
47
- go func () {
48
- // When client close the connection, cancel the context
49
- <- notify
50
- cancel ()
51
- }()
52
- }
53
- return ctx
54
- }
55
-
56
37
// ServeHTTP handles requests as a http.Handler
57
38
func (h * Handler ) ServeHTTP (w http.ResponseWriter , r * http.Request ) {
58
- ctx := getContext ( w , r )
39
+ ctx := r . Context ( )
59
40
h .ServeHTTPC (ctx , w , r )
60
41
}
61
42
You can’t perform that action at this time.
0 commit comments