Skip to content

Commit 7e9a852

Browse files
committed
Added maintainers to config and removed Utf8Json and removed content-length
1 parent 9c22f8b commit 7e9a852

4 files changed

Lines changed: 4 additions & 34 deletions

File tree

frameworks/CSharp/carter/Benchmarks/Benchmarks.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@
66

77
<ItemGroup>
88
<PackageReference Include="Carter" Version="10.0.0" />
9-
<PackageReference Include="Utf8Json" Version="1.3.7" />
109
</ItemGroup>
1110
</Project>
Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,14 @@
11
using Carter;
22
using Microsoft.AspNetCore.Builder;
3-
using Microsoft.AspNetCore.Http;
43
using Microsoft.AspNetCore.Routing;
5-
using Utf8Json;
64

75
namespace Benchmarks
86
{
97
public class JsonModule : ICarterModule
108
{
11-
private const int _bufferSize = 27;
12-
13-
public struct JsonMessage
14-
{
15-
public string message;
16-
}
17-
189
public void AddRoutes(IEndpointRouteBuilder app)
1910
{
20-
app.MapGet("/json", (HttpResponse res) =>
21-
{
22-
res.StatusCode = 200;
23-
res.ContentType = "application/json";
24-
res.ContentLength = _bufferSize;
25-
26-
var msg = new JsonMessage { message = "Hello, World!" };
27-
28-
return JsonSerializer.SerializeAsync(res.Body, msg);
29-
});
11+
app.MapGet("/json", () => new { message = "Hello, World!" });
3012
}
3113
}
3214
}
Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,14 @@
1-
using System.Text;
2-
using Carter;
1+
using Carter;
32
using Microsoft.AspNetCore.Builder;
4-
using Microsoft.AspNetCore.Http;
53
using Microsoft.AspNetCore.Routing;
64

75
namespace Benchmarks
86
{
97
public class PlainModule : ICarterModule
108
{
11-
private static readonly byte[] _helloWorldPayload = Encoding.UTF8.GetBytes("Hello, World!");
12-
13-
149
public void AddRoutes(IEndpointRouteBuilder app)
1510
{
16-
app.MapGet("/plaintext", (HttpResponse res) =>
17-
{
18-
var payloadLength = _helloWorldPayload.Length;
19-
res.StatusCode = 200;
20-
res.ContentType = "text/plain";
21-
res.ContentLength = payloadLength;
22-
return res.Body.WriteAsync(_helloWorldPayload, 0, payloadLength);
23-
});
11+
app.MapGet("/plaintext", () => "Hello, World!");
2412
}
2513
}
2614
}

frameworks/CSharp/carter/benchmark_config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"framework": "carter",
3+
"maintainers":["jchannon"],
34
"tests": [{
45
"default": {
56
"plaintext_url": "/plaintext",

0 commit comments

Comments
 (0)