diff --git a/sama/Services/SlackNotificationService.cs b/sama/Services/SlackNotificationService.cs index 73f16d3..fa4e489 100644 --- a/sama/Services/SlackNotificationService.cs +++ b/sama/Services/SlackNotificationService.cs @@ -104,7 +104,13 @@ protected virtual void SendNotification(string message) using var httpHandler = _serviceProvider.GetRequiredService(); using var client = new HttpClient(httpHandler, false); var data = JsonConvert.SerializeObject(new { text = message }); - client.PostAsync(url, new StringContent(data)).Wait(); + var content = new StringContent(data); + content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json"); + using var response = client.PostAsync(url, content).Result; + if (!response.IsSuccessStatusCode) + { + _logger.LogError(0, $"Unable to send Slack notification: HTTP {(int)response.StatusCode}", new Exception(response.Content.ReadAsStringAsync().Result)); + } } catch (Exception ex) { diff --git a/sama/sama.csproj b/sama/sama.csproj index 838edc2..d75742a 100644 --- a/sama/sama.csproj +++ b/sama/sama.csproj @@ -8,8 +8,8 @@ true $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; aspnet-WebApplication1-1C1369D5-B3C7-4414-ADD2-629BA88766C5 - 1.2.2 - 1.2.2 + 1.2.3 + 1.2.3 $([System.DateTime]::UtcNow.ToString(`yyyyMMdd-HHmm`))