Skip to content

Commit

Permalink
Update packages, cleanup code
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinTTY committed Mar 26, 2024
1 parent fc9830a commit c6aff43
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,26 @@ namespace RobinTTY.NordigenApiClient.Tests;

public class NordigenApiClientTests
{
/// <summary>
/// Executes a request to the Nordigen API using the default base address.
/// </summary>
[Test]
public async Task ExecuteRequestWithDefaultBaseAddress()
{
var apiClient = TestExtensions.GetConfiguredClient();
await ExecuteExampleRequest(apiClient);
}

/// <summary>
/// Executes a request to the Nordigen API using a custom base address.
/// </summary>
[Test]
public async Task ExecuteRequestWithCustomBaseAddress()
{
var apiClient = TestExtensions.GetConfiguredClient("https://ob.gocardless.com/api/v2/");
await ExecuteExampleRequest(apiClient);
}

private async Task ExecuteExampleRequest(NordigenClient apiClient)
{
var response = await apiClient.TokenEndpoint.GetTokenPair();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="NUnit" Version="4.0.1" />
<PackageReference Include="NUnit" Version="4.1.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0"/>
<PackageReference Include="NUnit.Analyzers" Version="4.0.1">
<PackageReference Include="NUnit.Analyzers" Version="4.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.1">
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion src/RobinTTY.NordigenApiClient/NordigenClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ internal async Task<NordigenApiResponse<TResponse, TError>> MakeRequest<TRespons
bool useAuthentication = true
) where TResponse : class where TError : class
{
var requestUri = query != null ? $"{uri}?{UriQueryBuilder.GetQueryString(query)}" : uri;
var requestUri = query != null ? uri + UriQueryBuilder.GetQueryString(query) : uri;
HttpClient client;
if (useAuthentication)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="7.3.1"/>
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="7.4.1" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0'">
Expand Down
2 changes: 1 addition & 1 deletion src/RobinTTY.NordigenApiClient/Utility/UriQueryBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ internal static string GetQueryString(IEnumerable<KeyValuePair<string, string>>
{
var query = HttpUtility.ParseQueryString(string.Empty);
foreach (var kvp in queryKeyValuePairs) query.Add(kvp.Key, kvp.Value);
return query.ToString();
return query.ToString() == null ? string.Empty : $"?{query}";
}
}

0 comments on commit c6aff43

Please sign in to comment.