File tree Expand file tree Collapse file tree 1 file changed +22
-29
lines changed
packages/event-handler/tests/unit/rest Expand file tree Collapse file tree 1 file changed +22
-29
lines changed Original file line number Diff line number Diff line change @@ -76,36 +76,29 @@ export const createTestALBEvent = (
7676 path : string ,
7777 httpMethod : string ,
7878 headers : Record < string , string > = { } ,
79- body : string | JSONValue = null
80- ) : ALBEvent => {
81- const stringBody =
82- typeof body === 'string'
83- ? body
84- : body !== null
85- ? JSON . stringify ( body )
86- : null ;
87-
88- return {
89- path,
90- httpMethod,
91- headers,
92- // ALB events represent GET and PATCH request bodies as empty strings
93- body :
94- httpMethod === HttpVerbs . GET || httpMethod === HttpVerbs . PATCH
95- ? ''
96- : stringBody ,
97- multiValueHeaders : { } ,
98- isBase64Encoded : false ,
99- queryStringParameters : undefined ,
100- multiValueQueryStringParameters : undefined ,
101- requestContext : {
102- elb : {
103- targetGroupArn :
104- 'arn:aws:elasticloadbalancing:us-east-1:123456789012:targetgroup/test/50dc6c495c0c9188' ,
105- } ,
79+ body : JSONValue = null
80+ ) : ALBEvent => ( {
81+ path,
82+ httpMethod,
83+ headers,
84+ // ALB events represent GET and PATCH request bodies as empty strings
85+ body :
86+ httpMethod === HttpVerbs . GET || httpMethod === HttpVerbs . PATCH
87+ ? ''
88+ : body === null
89+ ? null
90+ : JSON . stringify ( body ) ,
91+ multiValueHeaders : { } ,
92+ isBase64Encoded : false ,
93+ queryStringParameters : undefined ,
94+ multiValueQueryStringParameters : undefined ,
95+ requestContext : {
96+ elb : {
97+ targetGroupArn :
98+ 'arn:aws:elasticloadbalancing:us-east-1:123456789012:targetgroup/test/50dc6c495c0c9188' ,
10699 } ,
107- } ;
108- } ;
100+ } ,
101+ } ) ;
109102
110103export const createTrackingMiddleware = (
111104 name : string ,
You can’t perform that action at this time.
0 commit comments