summary refs log tree commit diff
path: root/MxApiExtensions/Program.cs
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-08-14 19:45:52 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-08-14 19:45:52 +0200
commit8253ca8cb96154f95854b1c1e5dd3ba53f41e5ec (patch)
tree34976d3e005f91ba479ce8286a9ffa6ac9651237 /MxApiExtensions/Program.cs
parentInitial commit (diff)
downloadMxApiExtensions-8253ca8cb96154f95854b1c1e5dd3ba53f41e5ec.tar.xz
Code cleanup
Diffstat (limited to '')
-rw-r--r--MxApiExtensions/Program.cs5
1 files changed, 3 insertions, 2 deletions
diff --git a/MxApiExtensions/Program.cs b/MxApiExtensions/Program.cs
index 00afe09..11fe114 100644
--- a/MxApiExtensions/Program.cs
+++ b/MxApiExtensions/Program.cs
@@ -1,3 +1,4 @@
+using Microsoft.AspNetCore.Http.Timeouts;
 using MxApiExtensions;
 
 var builder = WebApplication.CreateBuilder(args);
@@ -15,13 +16,13 @@ builder.Services.AddSingleton<CacheConfiguration>();
 builder.Services.AddScoped<Auth>();
 
 builder.Services.AddRequestTimeouts(x => {
-    x.DefaultPolicy = new() {
+    x.DefaultPolicy = new RequestTimeoutPolicy {
         Timeout = TimeSpan.FromMinutes(10),
         WriteTimeoutResponse = async context => {
             context.Response.StatusCode = 504;
             context.Response.ContentType = "application/json";
             await context.Response.StartAsync();
-            await context.Response.WriteAsJsonAsync(new MatrixException() {
+            await context.Response.WriteAsJsonAsync(new MatrixException {
                 ErrorCode = "M_TIMEOUT",
                 Error = "Request timed out"
             }.GetAsJson());