Fix tests ..ish.

This commit is contained in:
jvyden 2021-11-18 15:08:51 -05:00
parent 5e27f8c29b
commit e4bb16100d
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
6 changed files with 57 additions and 6 deletions

View file

@ -0,0 +1,24 @@
using System.Net;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
namespace LBPUnion.ProjectLighthouse
{
public class FakeRemoteIPAddressMiddleware
{
private readonly RequestDelegate next;
private readonly IPAddress fakeIpAddress = IPAddress.Parse("127.0.0.1");
public FakeRemoteIPAddressMiddleware(RequestDelegate next)
{
this.next = next;
}
public async Task Invoke(HttpContext httpContext)
{
httpContext.Connection.RemoteIpAddress = this.fakeIpAddress;
await this.next(httpContext);
}
}
}