Skip to content

Commit 1c80b17

Browse files
committed
Reuse ISessionFeature as we're testing its existence
1 parent 6fd2f47 commit 1c80b17

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tracer/src/Datadog.Trace/AppSec/Coordinator/SecurityCoordinatorHelpers.Core.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ internal static void CheckPathParamsAndSessionId(this Security security, HttpCon
8282
var args = new Dictionary<string, object> { { AddressesConstants.RequestPathParams, pathParams } };
8383
IResult? result;
8484
// we need to check context.Features.Get<ISessionFeature> as accessing the Session item if session has not been configured for the application is throwing InvalidOperationException
85-
if (context.Features.Get<ISessionFeature>() is not null && (context.Session?.IsAvailable ?? false))
85+
if (context.Features.Get<ISessionFeature>() is { } feature && (feature.Session?.IsAvailable ?? false))
8686
{
87-
result = securityCoordinator.RunWaf(args, sessionId: context.Session.Id);
87+
result = securityCoordinator.RunWaf(args, sessionId: feature.Session.Id);
8888
}
8989
else
9090
{

0 commit comments

Comments
 (0)