This commit is contained in:
Anna 2022-09-04 01:17:03 -04:00
parent 803f3c139b
commit c99bff2839
1 changed files with 6 additions and 3 deletions

View File

@ -1,3 +1,5 @@
using System.Net.Http.Headers;
namespace OrangeGuidanceTomestone.Helpers;
internal static class ServerHelper {
@ -10,12 +12,13 @@ internal static class ServerHelper {
var req = new HttpRequestMessage(method, url);
if (content != null) {
req.Content = content;
if (contentType != null) {
req.Content.Headers.ContentType = new MediaTypeHeaderValue(contentType);
}
}
req.Headers.Add("X-Api-Key", apiKey);
if (contentType != null) {
req.Headers.Add("Content-Type", contentType);
}
return req;
}