This repository was archived by the owner on Aug 6, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,12 +9,12 @@ import (
99
1010type HandlerFuncAdapter struct {
1111 core.RequestAccessor
12- handler http.Handler
12+ handlerFunc http.HandlerFunc
1313}
1414
1515func New (handlerFunc http.HandlerFunc ) * HandlerFuncAdapter {
1616 return & HandlerFuncAdapter {
17- handler : handlerFunc ,
17+ handlerFunc : handlerFunc ,
1818 }
1919}
2020
@@ -25,7 +25,7 @@ func (h *HandlerFuncAdapter) Proxy(event events.APIGatewayProxyRequest) (events.
2525 }
2626
2727 w := core .NewProxyResponseWriter ()
28- h .handler .ServeHTTP (http .ResponseWriter (w ), req )
28+ h .handlerFunc .ServeHTTP (http .ResponseWriter (w ), req )
2929
3030 resp , err := w .GetProxyResponse ()
3131 if err != nil {
Original file line number Diff line number Diff line change @@ -12,24 +12,17 @@ import (
1212 . "github.com/onsi/gomega"
1313)
1414
15- type handler struct {}
16-
17- func (h handler ) ServeHTTP (w http.ResponseWriter , req * http.Request ) {
18- w .Header ().Add ("unfortunately-required-header" , "" )
19- fmt .Fprintf (w , "Go Lambda!!" )
20- }
21-
2215var _ = Describe ("HandlerFuncAdapter tests" , func () {
2316 Context ("Simple ping request" , func () {
2417 It ("Proxies the event correctly" , func () {
2518 log .Println ("Starting test" )
2619
27- handlerFunc := func (w http.ResponseWriter , req * http.Request ) {
20+ handler := func (w http.ResponseWriter , req * http.Request ) {
2821 w .Header ().Add ("unfortunately-required-header" , "" )
2922 fmt .Fprintf (w , "Go Lambda!!" )
3023 }
3124
32- adapter := handlerfunc .New (handlerFunc )
25+ adapter := handlerfunc .New (handler )
3326
3427 req := events.APIGatewayProxyRequest {
3528 Path : "/ping" ,
You can’t perform that action at this time.
0 commit comments