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

samsmithnz / RepoGovernance / 4288717114

pending completion
4288717114

Pull #368

github

GitHub
Merge bf7f0a474 into 4bc30975e
Pull Request #368: Updated packages

121 of 210 branches covered (57.62%)

Branch coverage included in aggregate %.

447 of 566 relevant lines covered (78.98%)

7.94 hits per line

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

86.11
/src/RepoGovernance.Core/APIAccess/BaseApi.cs
1
using Newtonsoft.Json;
2

3
namespace RepoGovernance.Core.APIAccess
4
{
5
    public static class BaseApi
6
    {
7
        public static async Task<T?> GetResponse<T>(HttpClient client, string url, bool ignoreErrors = false)
8
        {
2✔
9
            T? obj = default;
2✔
10
            if (client != null && url != null)
2!
11
            {
2✔
12
                using (HttpResponseMessage response = await client.GetAsync(url))
2✔
13
                {
2✔
14
                    if (ignoreErrors == true || response.IsSuccessStatusCode == true)
2!
15
                    {
2✔
16
                        if (response.StatusCode.ToString() != "NotFound")
2✔
17
                        {
2✔
18
                            string responseBody = await response.Content.ReadAsStringAsync();
2✔
19
                            if (string.IsNullOrEmpty(responseBody) == false)
2✔
20
                            {
2✔
21
                                obj = JsonConvert.DeserializeObject<T>(responseBody);
2✔
22
                            }
2✔
23
                        }
2✔
24
                    }
2✔
25
                    else
26
                    {
×
27
                        //Throw an exception
28
                        response.EnsureSuccessStatusCode();
×
29
                    }
×
30
                }
2✔
31
            }
2✔
32
            return obj;
2✔
33
        }
2✔
34
    }
35
}
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