mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-26 22:46:53 -04:00
New: Use native dotnet host and DryIoc
(cherry picked from commit d6170dbfedf27a6218afe242a0fae2eb8b368aec) (cherry picked from commit 7fe36a7e9222e830f4920e09a85115df0bdbf190)
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace Radarr.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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user