@@ -434,3 +434,45 @@ func TestApiGatewayV2HTTPRequestNoAuthorizerMarshaling(t *testing.T) {
434
434
435
435
assert .JSONEq (t , string (inputJSON ), string (outputJSON ))
436
436
}
437
+
438
+ func TestApiGatewayV2CustomAuthorizerV1RequestMarshaling (t * testing.T ) {
439
+ inputJSON , err := ioutil .ReadFile ("./testdata/apigw-v2-custom-authorizer-v1-request.json" )
440
+ if err != nil {
441
+ t .Errorf ("could not open test file. details: %v" , err )
442
+ }
443
+
444
+ // de-serialize into Go object
445
+ var inputEvent APIGatewayV2CustomAuthorizerV1Request
446
+ if err := json .Unmarshal (inputJSON , & inputEvent ); err != nil {
447
+ t .Errorf ("could not unmarshal event. details: %v" , err )
448
+ }
449
+
450
+ // serialize to json
451
+ outputJSON , err := json .Marshal (inputEvent )
452
+ if err != nil {
453
+ t .Errorf ("could not marshal event. details: %v" , err )
454
+ }
455
+
456
+ assert .JSONEq (t , string (inputJSON ), string (outputJSON ))
457
+ }
458
+
459
+ func TestApiGatewayV2CustomAuthorizerV2RequestMarshaling (t * testing.T ) {
460
+ inputJSON , err := ioutil .ReadFile ("./testdata/apigw-v2-custom-authorizer-v2-request.json" )
461
+ if err != nil {
462
+ t .Errorf ("could not open test file. details: %v" , err )
463
+ }
464
+
465
+ // de-serialize into Go object
466
+ var inputEvent APIGatewayV2CustomAuthorizerV2Request
467
+ if err := json .Unmarshal (inputJSON , & inputEvent ); err != nil {
468
+ t .Errorf ("could not unmarshal event. details: %v" , err )
469
+ }
470
+
471
+ // serialize to json
472
+ outputJSON , err := json .Marshal (inputEvent )
473
+ if err != nil {
474
+ t .Errorf ("could not marshal event. details: %v" , err )
475
+ }
476
+
477
+ assert .JSONEq (t , string (inputJSON ), string (outputJSON ))
478
+ }
0 commit comments