mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-30 00:22:40 +01:00
Merge fixes
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tgstation.Server.Common.Tests
|
||||
{
|
||||
/// <summary>
|
||||
/// Simple mock <see cref="HttpMessageHandler"/>.
|
||||
/// </summary>
|
||||
public sealed class MockHttpMessageHandler : HttpMessageHandler
|
||||
{
|
||||
readonly Func<HttpRequestMessage, CancellationToken, Task<HttpResponseMessage>> callback;
|
||||
|
||||
public MockHttpMessageHandler(Func<HttpRequestMessage, CancellationToken, Task<HttpResponseMessage>> callback)
|
||||
{
|
||||
this.callback = callback ?? throw new ArgumentNullException(nameof(callback));
|
||||
}
|
||||
|
||||
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
|
||||
=> callback(request, cancellationToken);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user