From 8ced6269af5488830b5df51b2778d40da297f4f2 Mon Sep 17 00:00:00 2001 From: Matthias Wessendorf Date: Tue, 26 Mar 2024 13:05:16 +0100 Subject: [PATCH] Usage of only proper handler API, no longer need for redundant Context (#2249) Signed-off-by: Matthias Wessendorf --- docs/function-templates/golang.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/docs/function-templates/golang.md b/docs/function-templates/golang.md index 39fd2bd5..3bb13e27 100644 --- a/docs/function-templates/golang.md +++ b/docs/function-templates/golang.md @@ -94,16 +94,14 @@ They each will listen and respond to incoming HTTP events. #### Function triggered by HTTP request -When an incoming request is received, your function will be invoked with a standard -Golang [Context](https://golang.org/pkg/context/) as the first parameter followed by -two parameters: Golang's [http.ResponseWriter](https://golang.org/pkg/net/http/#ResponseWriter) -and [http.Request](https://golang.org/pkg/net/http/#Request). +When an incoming request is received, your function will be invoked with two parameters: +Golang's [http.ResponseWriter](https://golang.org/pkg/net/http/#ResponseWriter) and [http.Request](https://golang.org/pkg/net/http/#Request). Then you can use standard Golang techniques to access the request (eg. read the body) and set a proper HTTP response of your function, as you can see on the following example: ```go -func Handle(ctx context.Context, res http.ResponseWriter, req *http.Request) { +func Handle(res http.ResponseWriter, req *http.Request) { // Read body body, err := ioutil.ReadAll(req.Body)