@@ -13,10 +13,13 @@ describe('eventToRequestOptions', () => {
13
13
const reqOpts = eventToRequestOptions ( eventRestApi ) ;
14
14
expect ( reqOpts ) . toEqual ( {
15
15
"method" : "GET" ,
16
- "path" : "/inspect?param=ab%20cd" ,
16
+ "path" : {
17
+ pathname : "/inspect" ,
18
+ protocol : 'https' ,
19
+ query : { "param" : "ab cd" } ,
20
+ } ,
17
21
"remoteAddress" : "1.152.111.246" ,
18
- "body" : Buffer . alloc ( 0 ) ,
19
- "ssl" : true ,
22
+ "payload" : Buffer . alloc ( 0 ) ,
20
23
"headers" : {
21
24
"accept" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3" ,
22
25
"accept-language" : "en-US,en;q=0.9,pl-PL;q=0.8,pl;q=0.7,ru;q=0.6" ,
@@ -45,10 +48,13 @@ describe('eventToRequestOptions', () => {
45
48
const reqOpts = eventToRequestOptions ( eventHttpApiV1 ) ;
46
49
expect ( reqOpts ) . toEqual ( {
47
50
"method" : "GET" ,
48
- "path" : "/inspect?param=ab%20cd" ,
51
+ "path" : {
52
+ pathname : "/inspect" ,
53
+ protocol : 'https' ,
54
+ query : { "param" : "ab cd" } ,
55
+ } ,
49
56
"remoteAddress" : "9.9.9.9" ,
50
- "body" : Buffer . alloc ( 0 ) ,
51
- "ssl" : true ,
57
+ "payload" : Buffer . alloc ( 0 ) ,
52
58
"headers" : {
53
59
"content-length" : "0" ,
54
60
"host" : "apiid.execute-api.ap-southeast-2.amazonaws.com" ,
@@ -74,10 +80,13 @@ describe('eventToRequestOptions', () => {
74
80
const reqOpts = eventToRequestOptions ( eventHttpApiV2 ) ;
75
81
expect ( reqOpts ) . toEqual ( {
76
82
"method" : "GET" ,
77
- "path" : "/inspect?param=ab%20cd" ,
83
+ "path" : {
84
+ pathname : "/inspect" ,
85
+ protocol : 'https' ,
86
+ query : { "param" : "ab cd" } ,
87
+ } ,
78
88
"remoteAddress" : "9.9.9.9" ,
79
- "body" : Buffer . alloc ( 0 ) ,
80
- "ssl" : true ,
89
+ "payload" : Buffer . alloc ( 0 ) ,
81
90
"headers" : {
82
91
"accept" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" ,
83
92
"accept-encoding" : "gzip, deflate, br" ,
@@ -104,10 +113,13 @@ describe('eventToRequestOptions', () => {
104
113
const reqOpts = eventToRequestOptions ( eventHttpApiLegacy ) ;
105
114
expect ( reqOpts ) . toEqual ( {
106
115
"method" : "GET" ,
107
- "path" : "/inspect?param=ab%20cd" ,
116
+ "path" : {
117
+ pathname : "/inspect" ,
118
+ protocol : 'https' ,
119
+ query : { "param" : "ab cd" } ,
120
+ } ,
108
121
"remoteAddress" : "9.9.9.9" ,
109
- "body" : Buffer . alloc ( 0 ) ,
110
- "ssl" : true ,
122
+ "payload" : Buffer . alloc ( 0 ) ,
111
123
"headers" : {
112
124
"content-length" : "0" ,
113
125
"host" : "apiid.execute-api.ap-southeast-2.amazonaws.com" ,
@@ -126,10 +138,13 @@ describe('eventToRequestOptions', () => {
126
138
const reqOpts = eventToRequestOptions ( eventAlb ) ;
127
139
expect ( reqOpts ) . toEqual ( {
128
140
"method" : "GET" ,
129
- "path" : "/inspect?param=ab%20cd" ,
141
+ "path" : {
142
+ pathname : "/inspect" ,
143
+ protocol : 'http' ,
144
+ query : { "param" : "ab cd" } ,
145
+ } ,
130
146
"remoteAddress" : "1.136.104.131" ,
131
- "body" : Buffer . alloc ( 0 ) ,
132
- "ssl" : false ,
147
+ "payload" : Buffer . alloc ( 0 ) ,
133
148
"headers" : {
134
149
"accept" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3" ,
135
150
"accept-language" : "en-US,en;q=0.9,pl-PL;q=0.8,pl;q=0.7,ru;q=0.6" ,
@@ -148,10 +163,15 @@ describe('eventToRequestOptions', () => {
148
163
const reqOpts = eventToRequestOptions ( evenMultiHeadertAlb ) ;
149
164
expect ( reqOpts ) . toEqual ( {
150
165
"method" : "GET" ,
151
- "path" : "/inspect?param=ab%20cd" ,
166
+ "path" : {
167
+ pathname : "/inspect" ,
168
+ protocol : 'http' ,
169
+ query : {
170
+ "param" : "ab cd" ,
171
+ } ,
172
+ } ,
152
173
"remoteAddress" : "1.136.104.131" ,
153
- "body" : Buffer . alloc ( 0 ) ,
154
- "ssl" : false ,
174
+ "payload" : Buffer . alloc ( 0 ) ,
155
175
"headers" : {
156
176
"accept" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3" ,
157
177
"accept-language" : "en-US,en;q=0.9,pl-PL;q=0.8,pl;q=0.7,ru;q=0.6" ,
@@ -191,10 +211,13 @@ describe('eventToRequestOptions', () => {
191
211
} ) ;
192
212
expect ( reqOpts ) . toEqual ( {
193
213
"method" : "HEAD" ,
194
- "path" : "/" ,
214
+ "path" : {
215
+ pathname : "/" ,
216
+ protocol : 'http' ,
217
+ query : { } ,
218
+ } ,
195
219
"remoteAddress" : '129.45.45.48' ,
196
- "body" : Buffer . alloc ( 0 ) ,
197
- "ssl" : false ,
220
+ "payload" : Buffer . alloc ( 0 ) ,
198
221
"headers" : {
199
222
"x-forwarded-for" : "10.10.2.3" ,
200
223
"x-forwarded-proto" : "http" ,
@@ -223,10 +246,13 @@ describe('eventToRequestOptions', () => {
223
246
224
247
expect ( reqOpts ) . toEqual ( {
225
248
"method" : "HEAD" ,
226
- "path" : "/" ,
249
+ "path" : {
250
+ pathname : "/" ,
251
+ protocol : 'https' ,
252
+ query : { } ,
253
+ } ,
227
254
"remoteAddress" : '129.45.45.48' ,
228
- "body" : Buffer . alloc ( 0 ) ,
229
- "ssl" : true ,
255
+ "payload" : Buffer . alloc ( 0 ) ,
230
256
"headers" : {
231
257
} ,
232
258
} )
@@ -236,10 +262,13 @@ describe('eventToRequestOptions', () => {
236
262
const reqOpts = eventToRequestOptions ( eventHealth ) ;
237
263
expect ( reqOpts ) . toEqual ( {
238
264
"method" : "HEAD" ,
239
- "path" : "/" ,
265
+ "path" : {
266
+ pathname : "/" ,
267
+ protocol : 'http' ,
268
+ query : { } ,
269
+ } ,
240
270
"remoteAddress" : undefined ,
241
- "body" : Buffer . alloc ( 0 ) ,
242
- "ssl" : false ,
271
+ "payload" : Buffer . alloc ( 0 ) ,
243
272
"headers" : {
244
273
"user-agent" : "ELB-HealthChecker/2.0" ,
245
274
} ,
0 commit comments