pcut_uwp/PCUT/Http.Core/Handlers/DeviceAuthHandler.cs

20 lines
569 B
C#

using Http.Core.Contexts;
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Http.Core.Handlers
{
public class DeviceAuthHandler : DelegatingHandler
{
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
request.Headers.Add("x-device-id", $"{UserContext.Instance.DeviceId}");
return base.SendAsync(request, cancellationToken);
}
}
}