Add IP origin enrichment with DB-IP and world map
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
536aee1f31
commit
3671019e60
47 files changed
+1389
-12
No files matched your search
@@ -0,0 +1,22 @@
|
||||
using System.Collections.Concurrent;
|
||||
using System.Net;
|
||||
|
||||
namespace Flypaper.Tests.Fakes;
|
||||
|
||||
internal sealed class FakeHttpHandler : HttpMessageHandler
|
||||
{
|
||||
private readonly ConcurrentDictionary<string, Func<HttpResponseMessage>> _responses = new();
|
||||
|
||||
public ConcurrentQueue<string> Requests { get; } = new();
|
||||
|
||||
public void Respond(string url, Func<HttpResponseMessage> response) => _responses[url] = response;
|
||||
|
||||
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
|
||||
{
|
||||
var url = request.RequestUri!.ToString();
|
||||
Requests.Enqueue(url);
|
||||
return Task.FromResult(_responses.TryGetValue(url, out var response)
|
||||
? response()
|
||||
: new HttpResponseMessage(HttpStatusCode.NotFound));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Flypaper.Tests.Fakes;
|
||||
|
||||
internal sealed class FixedTimeProvider(DateTimeOffset now) : TimeProvider
|
||||
{
|
||||
public override DateTimeOffset GetUtcNow() => now;
|
||||
}
|
||||
Reference in new issue
Block a user