Use native HttpMethod

This commit is contained in:
Qstick
2022-01-03 00:28:20 -06:00
parent e04133d34a
commit 76b6b0dead
56 changed files with 198 additions and 147 deletions

View File

@@ -1,3 +1,5 @@
using System;
using System.Net.Http;
using NzbDrone.Common.Extensions;
using NzbDrone.Common.Http;
using NzbDrone.Common.Serializer;
@@ -26,7 +28,13 @@ namespace NzbDrone.Core.Notifications.Webhook
.Accept(HttpAccept.Json)
.Build();
request.Method = (HttpMethod)settings.Method;
request.Method = settings.Method switch
{
(int)WebhookMethod.POST => HttpMethod.Post,
(int)WebhookMethod.PUT => HttpMethod.Put,
_ => throw new ArgumentOutOfRangeException($"Invalid Webhook method {settings.Method}")
};
request.Headers.ContentType = "application/json";
request.SetContent(body.ToJson());