Browse Source

[genhttp] Update to version 6.3 (#6990)

* [genhttp] Update to version 6.3

* Revert changes to JSON test to stay confirm with the testing specc
Andreas Nägeli 3 years ago
parent
commit
c577a961a1

+ 4 - 4
frameworks/CSharp/genhttp/Benchmarks/Benchmarks.csproj

@@ -26,10 +26,10 @@
   </ItemGroup>
     
   <ItemGroup>
-    <PackageReference Include="GenHTTP.Core" Version="6.2.0" />
-    <PackageReference Include="GenHTTP.Modules.Razor" Version="6.2.0" />
-    <PackageReference Include="GenHTTP.Modules.Webservices" Version="6.2.0" />
-    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.0" />
+    <PackageReference Include="GenHTTP.Core" Version="6.3.0" />
+    <PackageReference Include="GenHTTP.Modules.Razor" Version="6.3.0" />
+    <PackageReference Include="GenHTTP.Modules.Webservices" Version="6.3.0" />
+    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.1" />
     <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.1" />
   </ItemGroup>
   

+ 1 - 1
frameworks/CSharp/genhttp/Benchmarks/Model/DatabaseContext.cs

@@ -25,7 +25,7 @@ namespace Benchmarks.Model
         {
             var optionsBuilder = new DbContextOptionsBuilder<DatabaseContext>();
 
-            optionsBuilder.UseNpgsql("Server=tfb-database;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=18;NoResetOnClose=true;Enlist=false;Max Auto Prepare=4");
+            optionsBuilder.UseNpgsql("Server=tfb-database;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=256;NoResetOnClose=true;Enlist=false;Max Auto Prepare=4");
 
             if (!tracking)
             {

+ 6 - 6
frameworks/CSharp/genhttp/Benchmarks/Resources/Fortunes.html

@@ -1,7 +1,7 @@
-<table>
-    <tr><th>id</th><th>message</th></tr>
-    @foreach (var cookie in Model.Cookies)
-    {
-    <tr><td>@cookie.ID</td><td>@HttpUtility.HtmlEncode(cookie.Message)</td></tr>
-    }
+<table>
+    <tr><th>id</th><th>message</th></tr>
+    @foreach (var cookie in Model.Cookies)
+    {
+    <tr><td>@cookie.ID</td><td>@HttpUtility.HtmlEncode(cookie.Message)</td></tr>
+    }
 </table>

+ 8 - 8
frameworks/CSharp/genhttp/Benchmarks/Resources/Template.html

@@ -1,9 +1,9 @@
-<!DOCTYPE html>
-<html>
-<head>
-    <title>@Model.Meta.Title</title>
-</head>
-<body>
-    @Model.Content
-</body>
+<!DOCTYPE html>
+<html>
+<head>
+    <title>@Model.Meta.Title</title>
+</head>
+<body>
+    @Model.Content
+</body>
 </html>

+ 1 - 1
frameworks/CSharp/genhttp/Benchmarks/Tests/CacheResource.cs

@@ -17,7 +17,7 @@ namespace Benchmarks.Tests
     {
         private static readonly Random _Random = new Random();
 
-        private readonly MemoryCache _Cache = new MemoryCache(new MemoryCacheOptions() { ExpirationScanFrequency = TimeSpan.FromMinutes(60) });
+        private static readonly MemoryCache _Cache = new MemoryCache(new MemoryCacheOptions() { ExpirationScanFrequency = TimeSpan.FromMinutes(60) });
 
         private static readonly object[] _CacheKeys = Enumerable.Range(0, 10001).Select((i) => new CacheKey(i)).ToArray();
 

+ 1 - 1
frameworks/CSharp/genhttp/Benchmarks/Tests/DbResource.cs

@@ -12,7 +12,7 @@ namespace Benchmarks.Tests
 
     public sealed class DbResource
     {
-        private static Random _Random = new Random();
+        private static readonly Random _Random = new();
 
         [ResourceMethod]
         public async ValueTask<World> GetRandomWorld()

+ 2 - 10
frameworks/CSharp/genhttp/Benchmarks/Tests/FortuneHandler.cs

@@ -2,6 +2,7 @@
 using System.Threading.Tasks;
 using System.Linq;
 using System.Web;
+using System.IO;
 
 using Microsoft.EntityFrameworkCore;
 
@@ -13,7 +14,6 @@ using GenHTTP.Modules.IO;
 using GenHTTP.Modules.Razor;
 
 using Benchmarks.Model;
-using System.IO;
 
 namespace Benchmarks.Tests
 {
@@ -50,7 +50,6 @@ namespace Benchmarks.Tests
 
     public class FortuneHandler : IHandler, IPageRenderer
     {
-        private static readonly FlexibleContentType CONTENT_TYPE = new FlexibleContentType("text/html; charset=utf-8");
 
         #region Get-/Setters
 
@@ -95,14 +94,7 @@ namespace Benchmarks.Tests
 
         public ValueTask RenderAsync(TemplateModel model, Stream target) => Template.RenderAsync(model, target);
 
-        public async ValueTask<IResponse> HandleAsync(IRequest request)
-        {
-            var response = await Page.HandleAsync(request);
-
-            response.ContentType = CONTENT_TYPE;
-
-            return response;
-        }
+        public ValueTask<IResponse> HandleAsync(IRequest request) => Page.HandleAsync(request);
 
         private static async ValueTask<FortuneModel> GetFortunes(IRequest request, IHandler handler)
         {

+ 1 - 1
frameworks/CSharp/genhttp/Benchmarks/Tests/JsonResource.cs

@@ -14,7 +14,7 @@ namespace Benchmarks.Tests
     {
 
         [ResourceMethod]
-        public JsonResult GetMessage() => new JsonResult() { Message = "Hello, World!" };
+        public JsonResult GetMessage() => new() { Message = "Hello, World!" };
 
     }