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 src/Servers/EffinitiveServer/EffinitiveServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EffinitiveFramework.Core" Version="2.1.0" />
<PackageReference Include="EffinitiveFramework.Core" Version="2.1.2" />
</ItemGroup>

</Project>
18 changes: 16 additions & 2 deletions src/Servers/EffinitiveServer/Program.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Buffers;
using System.Text;
using EffinitiveFramework.Core;
using EffinitiveFramework.Core.Http;
Expand Down Expand Up @@ -35,10 +36,23 @@
protected override string Route => "/";
protected override string ContentType => Helpers.TextPlain;

public override ValueTask<string> HandleAsync(CancellationToken ct = default)
public override async ValueTask<string> HandleAsync(CancellationToken ct = default)

Check failure on line 39 in src/Servers/EffinitiveServer/Program.cs

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename parameter 'ct' to 'cancellationToken' to match the base class declaration.

See more on https://sonarcloud.io/project/issues?id=MDA2AV_Http11Probe&issues=AZ7erRf3xD2Wm65Inarb&open=AZ7erRf3xD2Wm65Inarb&pullRequest=132
{
if (HttpContext?.BodyDeferred == true && HttpContext.BodyStream != null)
{
using var ms = new MemoryStream();
var buf = ArrayPool<byte>.Shared.Rent(4096);
try
{
int r;
while ((r = await HttpContext.BodyStream.ReadAsync(buf.AsMemory(), ct)) > 0)
ms.Write(buf, 0, r);

Check warning on line 49 in src/Servers/EffinitiveServer/Program.cs

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Await WriteAsync instead.

See more on https://sonarcloud.io/project/issues?id=MDA2AV_Http11Probe&issues=AZ7erRf3xD2Wm65Inarc&open=AZ7erRf3xD2Wm65Inarc&pullRequest=132
}
finally { ArrayPool<byte>.Shared.Return(buf); }
return ms.Length > 0 ? Encoding.UTF8.GetString(ms.ToArray()) : "";
}
var body = HttpContext?.Body;
return ValueTask.FromResult(body is { Length: > 0 } ? Encoding.UTF8.GetString(body.Value.Span) : "");
return body is { Length: > 0 } ? Encoding.UTF8.GetString(body.Value.Span) : "";
}
}

Expand Down
Loading