From d9259e34b65e7fb45ed7c6b95f4f2306f9a859db Mon Sep 17 00:00:00 2001 From: "Alex Ellis (OpenFaaS Ltd)" Date: Sat, 4 Apr 2020 18:28:32 +0100 Subject: [PATCH] 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) --- handler.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/handler.go b/handler.go index c5bb2d6..b422db0 100644 --- a/handler.go +++ b/handler.go @@ -1,6 +1,7 @@ package handler import ( + "context" "net/http" ) @@ -24,6 +25,12 @@ type Request struct { QueryString string Method string Host string + ctx context.Context +} + +// Context is set for optional cancellation inflight requests. +func (r *Request) Context() context.Context { + return r.ctx } // FunctionHandler used for a serverless Go method invocation