-
Notifications
You must be signed in to change notification settings - Fork 476
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modified APIGatewayProxyFunction to enhance error output for Aggregat…
…eExceptions and TypeLoadExceptions. Refactored TestCallingWebAPI tests to use TestLambdaContext instead of null so that the APIGatewayProxyFunction class can assume ILambdaContext is never null. Also moved commonly called code into a single method. Created CustomAuthorizerContextOutput class for use by custom authorizers (since the serializer will serialize a null value). Modified ErrorTestsController to throw different exceptions based on the query string for testing custom error handling.
- Loading branch information
1 parent
359c128
commit e5b40dc
Showing
8 changed files
with
227 additions
and
73 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
Libraries/src/Amazon.Lambda.APIGatewayEvents/APIGatewayCustomAuthorizerContextOutput.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
namespace Amazon.Lambda.APIGatewayEvents | ||
{ | ||
using System.Runtime.Serialization; | ||
|
||
/// <summary> | ||
/// An object representing the expected format of an API Gateway custom authorizer response. | ||
/// </summary> | ||
[DataContract] | ||
public class APIGatewayCustomAuthorizerContextOutput | ||
{ | ||
/// <summary> | ||
/// Gets or sets the 'stringKey' property. | ||
/// </summary> | ||
[DataMember(Name = "stringKey", IsRequired = false)] | ||
public string StringKey { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the 'numKey' property. | ||
/// </summary> | ||
[DataMember(Name = "numKey", IsRequired = false)] | ||
public int? NumKey { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the 'boolKey' property. | ||
/// </summary> | ||
[DataMember(Name = "boolKey", IsRequired = false)] | ||
public bool? BoolKey { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...test/Amazon.Lambda.AspNetCoreServer.Test/values-get-aggregateerror-apigatway-request.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"resource": "/{proxy+}", | ||
"path": "/api/errortests", | ||
"httpMethod": "GET", | ||
"headers": null, | ||
"queryStringParameters": { | ||
"id": "aggregate-test" | ||
}, | ||
"pathParameters": { | ||
"proxy": "api/values" | ||
}, | ||
"stageVariables": null, | ||
"requestContext": { | ||
"accountId": "AAAAAAAAAAAA", | ||
"resourceId": "5agfss", | ||
"stage": "test-invoke-stage", | ||
"requestId": "test-invoke-request", | ||
"identity": { | ||
"cognitoIdentityPoolId": null, | ||
"accountId": "AAAAAAAAAAAA", | ||
"cognitoIdentityId": null, | ||
"caller": "BBBBBBBBBBBB", | ||
"apiKey": "test-invoke-api-key", | ||
"sourceIp": "test-invoke-source-ip", | ||
"cognitoAuthenticationType": null, | ||
"cognitoAuthenticationProvider": null, | ||
"userArn": "arn:aws:iam::AAAAAAAAAAAA:root", | ||
"userAgent": "Apache-HttpClient/4.5.x (Java/1.8.0_102)", | ||
"user": "AAAAAAAAAAAA" | ||
}, | ||
"resourcePath": "/{proxy+}", | ||
"httpMethod": "GET", | ||
"apiId": "t2yh6sjnmk" | ||
}, | ||
"body": null | ||
} |
Oops, something went wrong.