Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
publish:
env:
CONFIGURATION: 'Release'
DOTNET_VERSION: '8.0'
DOTNET_VERSION: '9.0'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
publish:
env:
CONFIGURATION: 'Release'
DOTNET_VERSION: '8.0'
DOTNET_VERSION: '9.0'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,11 @@

### 🐛 Bug Fixes

- Fixed a bug where the entire query string was encoded instead of only the query parameter keys and values.
- Fixed a bug where the entire query string was encoded instead of only the query parameter keys and values.

## 2.0.3

### 🛠 Technical

- Fixed HttpClientFactory usage in default request sender
- Migrate to SLNX
6 changes: 3 additions & 3 deletions NotoriousClient.Sample/Program.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// See https://aka.ms/new-console-template for more information

using Microsoft.Extensions.DependencyInjection;

using NotoriousClient.Builder;
using NotoriousClient.Builder.Authentication;
using NotoriousClient.Clients;
using NotoriousClient.Converters;
using NotoriousClient.Sender;

Console.WriteLine("Hello, World!");
Expand All @@ -25,6 +24,7 @@

services.AddHttpClient();
services.AddScoped<IRequestSender>((serviceProvider) => new RequestSender(serviceProvider.GetRequiredService<IHttpClientFactory>()));

services.AddScoped((serviceProvider) => new UserClient(serviceProvider.GetRequiredService<IRequestSender>(), "http://my.api.com/"));

ServiceProvider provider = services.BuildServiceProvider();
Expand Down Expand Up @@ -94,7 +94,7 @@

public override HttpRequestMessage Build()
{
HttpRequestMessage request = base.Build();
HttpRequestMessage request = base.Build();
request.Headers.Add("TOTO", toto);
return request;
}
Expand All @@ -113,7 +113,7 @@
{
}

public async Task GetToto()

Check warning on line 116 in NotoriousClient.Sample/Program.cs

View workflow job for this annotation

GitHub Actions / publish

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
{
}

Expand Down
50 changes: 0 additions & 50 deletions NotoriousClient.sln

This file was deleted.

14 changes: 14 additions & 0 deletions NotoriousClient.slnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Solution>
<Folder Name="/CI/">
<File Path=".github/workflows/prerelease.yml" />
<File Path=".github/workflows/release.yml" />
</Folder>
<Folder Name="/Docs/">
<File Path="CHANGELOG.md" />
<File Path="LICENSE.txt" />
<File Path="README.md" />
</Folder>
<Project Path="NotoriousClient.Sample/NotoriousClient.Sample.csproj" />
<Project Path="NotoriousClient.Tests.Unit/NotoriousClient.Tests.Unit.csproj" />
<Project Path="NotoriousClient/NotoriousClient.csproj" />
</Solution>
2 changes: 1 addition & 1 deletion NotoriousClient/NotoriousClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<PackageId>NotoriousClient</PackageId>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<VersionPrefix>2.0.2</VersionPrefix>
<VersionPrefix>2.0.3</VersionPrefix>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Authors>Brice SCHUMACHER</Authors>
<RepositoryUrl>https://github.com/Notorious-Coding/Notorious-Client/</RepositoryUrl>
Expand Down
8 changes: 4 additions & 4 deletions NotoriousClient/Sender/RequestSender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/// </summary>
public class RequestSender : IRequestSender
{
private readonly HttpClient _client;
private readonly IHttpClientFactory _factory;

/// <summary>
/// Initialize a new instance of <see cref="RequestSender"/>.
Expand All @@ -15,21 +15,21 @@ public class RequestSender : IRequestSender
public RequestSender(IHttpClientFactory factory)
{
ArgumentNullException.ThrowIfNull(factory, nameof(factory));
_client = factory.CreateClient();
_factory = factory;
}

/// <inheritdoc/>
public async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken = default)
{
HttpResponseMessage response = await _client.SendAsync(request, cancellationToken);
HttpResponseMessage response = await _factory.CreateClient().SendAsync(request, cancellationToken);

return response;
}

/// <inheritdoc/>
public HttpResponseMessage Send(HttpRequestMessage request)
{
return _client.Send(request);
return _factory.CreateClient().Send(request);
}
}
}
Loading