mirror of
https://github.com/bitwarden/mobile
synced 2026-01-02 08:33:17 +00:00
wip
This commit is contained in:
24
src/App/Utilities/TokenHttpRequestMessage.cs
Normal file
24
src/App/Utilities/TokenHttpRequestMessage.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using Bit.App.Abstractions;
|
||||
using Newtonsoft.Json;
|
||||
using XLabs.Ioc;
|
||||
|
||||
namespace Bit.App
|
||||
{
|
||||
public class TokenHttpRequestMessage : HttpRequestMessage
|
||||
{
|
||||
public TokenHttpRequestMessage()
|
||||
{
|
||||
var authService = Resolver.Resolve<IAuthService>();
|
||||
Headers.Add("Authorization", $"Bearer {authService.Token}");
|
||||
}
|
||||
|
||||
public TokenHttpRequestMessage(object requestObject)
|
||||
: this()
|
||||
{
|
||||
var stringContent = JsonConvert.SerializeObject(requestObject);
|
||||
Content = new StringContent(stringContent, Encoding.UTF8, "application/json");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user