File tree Expand file tree Collapse file tree 2 files changed +5
-12
lines changed Expand file tree Collapse file tree 2 files changed +5
-12
lines changed Original file line number Diff line number Diff line change @@ -9,12 +9,12 @@ import (
9
9
10
10
type HandlerFuncAdapter struct {
11
11
core.RequestAccessor
12
- handler http.Handler
12
+ handlerFunc http.HandlerFunc
13
13
}
14
14
15
15
func New (handlerFunc http.HandlerFunc ) * HandlerFuncAdapter {
16
16
return & HandlerFuncAdapter {
17
- handler : handlerFunc ,
17
+ handlerFunc : handlerFunc ,
18
18
}
19
19
}
20
20
@@ -25,7 +25,7 @@ func (h *HandlerFuncAdapter) Proxy(event events.APIGatewayProxyRequest) (events.
25
25
}
26
26
27
27
w := core .NewProxyResponseWriter ()
28
- h .handler .ServeHTTP (http .ResponseWriter (w ), req )
28
+ h .handlerFunc .ServeHTTP (http .ResponseWriter (w ), req )
29
29
30
30
resp , err := w .GetProxyResponse ()
31
31
if err != nil {
Original file line number Diff line number Diff line change @@ -12,24 +12,17 @@ import (
12
12
. "github.com/onsi/gomega"
13
13
)
14
14
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
-
22
15
var _ = Describe ("HandlerFuncAdapter tests" , func () {
23
16
Context ("Simple ping request" , func () {
24
17
It ("Proxies the event correctly" , func () {
25
18
log .Println ("Starting test" )
26
19
27
- handlerFunc := func (w http.ResponseWriter , req * http.Request ) {
20
+ handler := func (w http.ResponseWriter , req * http.Request ) {
28
21
w .Header ().Add ("unfortunately-required-header" , "" )
29
22
fmt .Fprintf (w , "Go Lambda!!" )
30
23
}
31
24
32
- adapter := handlerfunc .New (handlerFunc )
25
+ adapter := handlerfunc .New (handler )
33
26
34
27
req := events.APIGatewayProxyRequest {
35
28
Path : "/ping" ,
You can’t perform that action at this time.
0 commit comments