Skip to content

Commit baa9ddb

Browse files
Merge pull request #1 from grahamehorner/grahamehorner-patch-1
nullable checks
2 parents 8ddd91b + 3a190c7 commit baa9ddb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Libraries/src/Amazon.Lambda.AspNetCoreServer/APIGatewayProxyFunction.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ protected override void MarshallRequest(InvokeFeatures features, APIGatewayProxy
141141
requestFeatures.Scheme = "https";
142142
requestFeatures.Method = apiGatewayRequest.HttpMethod;
143143

144-
if (string.IsNullOrWhiteSpace(apiGatewayRequest.RequestContext?.DomainName))
144+
if (string.IsNullOrWhiteSpace(apiGatewayRequest?.RequestContext?.DomainName))
145145
{
146146
_logger.LogWarning($"Request does not contain domain name information but is derived from {nameof(APIGatewayProxyFunction)}.");
147147
}
@@ -199,8 +199,8 @@ protected override void MarshallRequest(InvokeFeatures features, APIGatewayProxy
199199

200200
if (!requestFeatures.Headers.ContainsKey("Host"))
201201
{
202-
var apiId = apiGatewayRequest.RequestContext?.ApiId ?? "";
203-
var stage = apiGatewayRequest.RequestContext?.Stage ?? "";
202+
var apiId = apiGatewayRequest?.RequestContext?.ApiId ?? "";
203+
var stage = apiGatewayRequest?.RequestContext?.Stage ?? "";
204204

205205
requestFeatures.Headers["Host"] = $"apigateway-{apiId}-{stage}";
206206
}
@@ -309,4 +309,4 @@ protected override APIGatewayProxyResponse MarshallResponse(IHttpResponseFeature
309309
return response;
310310
}
311311
}
312-
}
312+
}

0 commit comments

Comments
 (0)