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

moconnell / yolo / 19116466348

05 Nov 2025 09:12PM UTC coverage: 35.004% (-23.2%) from 58.251%
19116466348

push

github

web-flow
Merge pull request #37 from moconnell/36-feat-support-pure-unravel-factor-trading

Feat: support pure Unravel trading

107 of 364 branches covered (29.4%)

Branch coverage included in aggregate %.

30 of 368 new or added lines in 9 files covered. (8.15%)

1 existing line in 1 file now uncovered.

284 of 753 relevant lines covered (37.72%)

15.24 hits per line

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

0.0
/src/YoloAbstractions/Extensions/HttpClientExtensions.cs
1
using System;
2
using System.Collections.Generic;
3
using System.Net.Http;
4
using System.Net.Http.Json;
5
using System.Threading;
6
using System.Threading.Tasks;
7
using YoloAbstractions.Exceptions;
8
using YoloAbstractions.Interfaces;
9

10
namespace YoloAbstractions.Extensions;
11

12
public static class HttpClientExtensions
13
{
14
    public static async Task<TResponse> GetAsync<TResponse, TData>(
15
        this HttpClient httpClient,
16
        string url,
17
        IReadOnlyDictionary<string, string>? headers = null,
18
        CancellationToken cancellationToken = default)
19
        where TResponse : IApiResponse<TData>
20
    {
×
21
        ArgumentNullException.ThrowIfNull(httpClient, nameof(httpClient));
×
22
        ArgumentException.ThrowIfNullOrEmpty(url, nameof(url));
×
23

24
        var request = new HttpRequestMessage(HttpMethod.Get, url);
×
25
        if (headers != null)
×
26
        {
×
27
            foreach (var header in headers)
×
28
            {
×
29
                request.Headers.Add(header.Key, header.Value);
×
30
            }
×
31
        }
×
32

33
        using var response = await httpClient.SendAsync(request, cancellationToken);
×
34

35
        if (!response.IsSuccessStatusCode)
×
36
        {
×
37
            throw new ApiException(
×
NEW
38
                $"Could not fetch from API ({url}): {response.ReasonPhrase} ({response.StatusCode})");
×
39
        }
40

NEW
41
        var apiResponse = await response.Content.ReadFromJsonAsync<TResponse>(cancellationToken: cancellationToken);
×
42

43
        if (apiResponse is null || apiResponse.Data is null || apiResponse.Data.Count == 0)
×
44
        {
×
NEW
45
            throw new ApiException($"No data returned from API ({url})");
×
46
        }
47

48
        return apiResponse;
×
49
    }
×
50
}
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