< Summary - AsyncResponse (Release / net8.0+net10.0 / unit+integration)

Information
Class: AsyncResponse.Transports.SQS.SqsCorrelationIdExtractor
Assembly: AsyncResponse.Transports.SQS
File(s): /_/src/Transports/AsyncResponse.Transports.SQS/SqsCorrelationIdExtractor.cs
Line coverage
100%
Covered lines: 5
Uncovered lines: 0
Coverable lines: 5
Total lines: 25
Line coverage: 100%
Branch coverage
100%
Covered branches: 6
Total branches: 6
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
Extract(...)100%66100%

File(s)

/_/src/Transports/AsyncResponse.Transports.SQS/SqsCorrelationIdExtractor.cs

#LineLine coverage
 1namespace AsyncResponse.Transports.SQS;
 2
 3/// <summary>
 4/// Extracts the AsyncResponse correlation id from an inbound response message: first from the
 5/// configured message attribute, then from the JSON body via the configured paths (walked by the
 6/// shared <see cref="CorrelationIdJsonPaths"/>).
 7/// </summary>
 8internal static class SqsCorrelationIdExtractor
 9{
 10    /// <summary>Extracts the correlation id from the supplied SQS delivery.</summary>
 11    public static string? Extract(
 12        SqsTransportDelivery delivery,
 13        string messageJson,
 14        SqsAsyncResponseOptions options)
 15    {
 2816        if (!string.IsNullOrWhiteSpace(options.CorrelationIdAttribute)
 2817            && delivery.MessageAttributes.TryGetValue(options.CorrelationIdAttribute, out var attributeValue)
 2818            && !string.IsNullOrWhiteSpace(attributeValue))
 19        {
 420            return attributeValue;
 21        }
 22
 2423        return CorrelationIdJsonPaths.Extract(messageJson, options.CorrelationIdJsonPaths);
 24    }
 25}