• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

alunacjones / LSL.HttpMessageHandlers.Capturing.Dumps / 3

19 Nov 2025 12:29AM UTC coverage: 97.368% (+0.01%) from 97.354%
3

push

appveyor

Alun Jones
add some docs and ensure status code is retuurned

370 of 380 relevant lines covered (97.37%)

53.92 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

96.67
/src/LSL.HttpMessageHandlers.Capturing.Dumps/CaptureContextToDumpDataMapper.cs
1
using System.Linq;
2
using System.Threading.Tasks;
3
using LSL.HttpMessageHandlers.Capturing.Core;
4

5
namespace LSL.HttpMessageHandlers.Capturing.Dumps;
6

7
internal class CaptureContextToDumpDataMapper : ICaptureContextToDumpDataMapper
8
{
9
    public async Task<RequestAndResponseDump> Map(CaptureContext captureContext, IResolvedDumpCapturerOptions options)
10
    {
11
        var result = new RequestAndResponseDump()
34✔
12
        {
34✔
13
            DurationInSeconds = captureContext.TimeToRun.TotalSeconds,            
34✔
14
            Request = new()
34✔
15
            {
34✔
16
                RequestUri = options.UriTransformer(captureContext.Request.RequestUri),
34✔
17
                HttpMethod = captureContext.Request.Method.Method,
34✔
18
                Content = await options.ContentTypeDeserialiser.Deserialise(captureContext.Request.Content).ConfigureAwait(false),
34✔
19
                Headers = options.HeaderMapper((captureContext.Request.Content is null 
34✔
20
                    ? captureContext.Request.Headers
34✔
21
                    : captureContext.Request.Content.Headers.Concat(captureContext.Request.Headers))
34✔
22
                    .OrderBy(h => h.Key)
214✔
23
                    .ToHeaderDictionary())
34✔
24
            }
34✔
25
        };
34✔
26

27
        await captureContext.WithRequestAndResponseAsync(async (_, res) =>
34✔
28
            result.Response = new()
68✔
29
            {
68✔
30
                StatusCode = (int)res.StatusCode,
68✔
31
                Content = await options.ContentTypeDeserialiser.Deserialise(res.Content).ConfigureAwait(false),
68✔
32
                Headers = options.HeaderMapper((res.Content.Headers is null
68✔
33
                    ? res.Headers
68✔
34
                    : res.Content.Headers.Concat(res.Headers))
68✔
35
                    .OrderBy(h => h.Key)
136✔
36
                    .ToHeaderDictionary())
68✔
37
            }
68✔
38
        ).ConfigureAwait(false);
34✔
39

40
        captureContext.WithExceptionAndRequest((ex, _) => result.Exception = ex);
×
41

42
        return result;
34✔
43
    }
34✔
44
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc