Last active
May 24, 2019 11:52
-
-
Save dylanberry/6a5cf9c721e93548eacca391efb1a7d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Net; | |
using System.Net.Http; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using Newtonsoft.Json; | |
using VersionCheck.Common; | |
namespace VersionCheck | |
{ | |
public class VersionCheckHandler : DelegatingHandler | |
{ | |
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) | |
{ | |
await ProcessRequest(request, cancellationToken); | |
var response = await base.SendAsync(request, cancellationToken); | |
return response; | |
} | |
protected virtual Task<HttpRequestMessage> ProcessRequest(HttpRequestMessage request, CancellationToken cancellationToken) | |
{ | |
request.Headers.Add(HeaderKeys.ClientVersion, Xamarin.Essentials.VersionTracking.CurrentVersion); | |
return Task.FromResult(request); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment