Skip to content
This repository was archived by the owner on Jul 23, 2020. It is now read-only.

Commit d9259e3

Browse files
committed
Add Context
Requested by @spawn2kill in PR #6, however there was no issue and no instructions for testing. This is being put through in a separate commit to speed up the feedback cycle given all the comments and two commits which need to be squashed, this seems faster. Closes: #6 Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
1 parent 70701da commit d9259e3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

handler.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package handler
22

33
import (
4+
"context"
45
"net/http"
56
)
67

@@ -24,6 +25,12 @@ type Request struct {
2425
QueryString string
2526
Method string
2627
Host string
28+
ctx context.Context
29+
}
30+
31+
// Context is set for optional cancellation inflight requests.
32+
func (r *Request) Context() context.Context {
33+
return r.ctx
2734
}
2835

2936
// FunctionHandler used for a serverless Go method invocation

0 commit comments

Comments
 (0)