@@ -84,6 +84,10 @@ func TestHandler(t *testing.T) {
84
84
t .Errorf ("expected version to be '2.0', got %v" , requestedBodyJSON ["version" ])
85
85
}
86
86
87
+ if requestedBodyJSON ["routeKey" ] != "$default" {
88
+ t .Errorf ("expected routeKey to be '$default', got %v" , requestedBodyJSON ["routeKey" ])
89
+ }
90
+
87
91
if requestedBodyJSON ["rawPath" ] != "/foo/bar" {
88
92
t .Errorf ("expected rawPath to be '/foo/bar', got %v" , requestedBodyJSON ["rawPath" ])
89
93
}
@@ -114,6 +118,26 @@ func TestHandler(t *testing.T) {
114
118
}
115
119
116
120
requestContext := requestedBodyJSON ["requestContext" ].(map [string ]interface {})
121
+ if requestContext ["routeKey" ] != "$default" {
122
+ t .Errorf ("expected routeKey to be '$default', got %v" , requestContext ["routeKey" ])
123
+ }
124
+
125
+ if requestContext ["stage" ] != "$default" {
126
+ t .Errorf ("expected stage to be '$default', got %v" , requestContext ["stage" ])
127
+ }
128
+
129
+ if _ , ok := requestContext ["time" ].(string ); ! ok {
130
+ t .Errorf ("expected time to be a string, got %v" , requestContext ["time" ])
131
+ }
132
+
133
+ if _ , ok := requestContext ["timeEpoch" ].(float64 ); ! ok {
134
+ t .Errorf ("expected timeEpoch to be a float64, got %v" , requestContext ["timeEpoch" ])
135
+ }
136
+
137
+ if requestContext ["domainName" ] != req .Host {
138
+ t .Errorf ("expected domainName to be '%s', got %v" , req .Host , requestContext ["domainName" ])
139
+ }
140
+
117
141
httpContext := requestContext ["http" ].(map [string ]interface {})
118
142
119
143
if httpContext ["method" ] != "POST" {
@@ -131,4 +155,5 @@ func TestHandler(t *testing.T) {
131
155
if httpContext ["userAgent" ] != "Go-http-client/1.1" {
132
156
t .Errorf ("expected userAgent to be 'Go-http-client/1.1', got %v" , httpContext ["userAgent" ])
133
157
}
158
+
134
159
}
0 commit comments