mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-12 08:16:05 -07:00
Added Discord notification #865
This commit is contained in:
parent
4c797733ca
commit
43dbe854a6
18 changed files with 336 additions and 26 deletions
|
@ -60,7 +60,7 @@ namespace Ombi.Api
|
|||
}
|
||||
}
|
||||
|
||||
public async Task<string> Request(Request request)
|
||||
public async Task<string> RequestContent(Request request)
|
||||
{
|
||||
using (var httpClient = new HttpClient())
|
||||
{
|
||||
|
@ -93,5 +93,34 @@ namespace Ombi.Api
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task Request(Request request)
|
||||
{
|
||||
using (var httpClient = new HttpClient())
|
||||
{
|
||||
using (var httpRequestMessage = new HttpRequestMessage(request.HttpMethod, request.FullUri))
|
||||
{
|
||||
// Add the Json Body
|
||||
if (request.JsonBody != null)
|
||||
{
|
||||
httpRequestMessage.Content = new JsonContent(request.JsonBody);
|
||||
}
|
||||
|
||||
// Add headers
|
||||
foreach (var header in request.Headers)
|
||||
{
|
||||
httpRequestMessage.Headers.Add(header.Key, header.Value);
|
||||
|
||||
}
|
||||
using (var httpResponseMessage = await httpClient.SendAsync(httpRequestMessage))
|
||||
{
|
||||
if (!httpResponseMessage.IsSuccessStatusCode)
|
||||
{
|
||||
// Logging
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue