New: Use native dotnet host and DryIoc

This commit is contained in:
ta264
2021-03-11 21:07:09 +00:00
parent 58ddbcd77e
commit d6170dbfed
69 changed files with 907 additions and 5078 deletions

View File

@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
namespace Readarr.Http.Middleware
{
public class BufferingMiddleware
{
private readonly RequestDelegate _next;
private readonly List<string> _urls;
public BufferingMiddleware(RequestDelegate next, List<string> urls)
{
_next = next;
_urls = urls;
}
public async Task InvokeAsync(HttpContext context)
{
if (_urls.Any(p => context.Request.Path.StartsWithSegments(p, StringComparison.OrdinalIgnoreCase)))
{
context.Request.EnableBuffering();
}
await _next(context);
}
}
}