mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-24 14:11:29 +00:00
Fix tests ..ish.
This commit is contained in:
parent
5e27f8c29b
commit
e4bb16100d
6 changed files with 57 additions and 6 deletions
24
ProjectLighthouse/FakeRemoteIPAddressMiddleware.cs
Normal file
24
ProjectLighthouse/FakeRemoteIPAddressMiddleware.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue