Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/LaunchDarkly.EventSource/EventSourceService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ private void ValidateResponse(HttpResponseMessage response)
// Any non-2xx response status is an error. A 204 (no content) is also an error.
if (!response.IsSuccessStatusCode || response.StatusCode == System.Net.HttpStatusCode.NoContent)
{
throw new EventSourceServiceUnsuccessfulResponseException((int)response.StatusCode);
throw new EventSourceServiceUnsuccessfulResponseException((int)response.StatusCode, response.Headers);
}

if (response.Content == null)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Collections.Generic;

namespace LaunchDarkly.EventSource
{
Expand All @@ -14,6 +15,11 @@ public class EventSourceServiceUnsuccessfulResponseException : EventSourceServic
/// </summary>
public int StatusCode { get; }

/// <summary>
/// The HTTP headers from the response.
/// </summary>
public IEnumerable<KeyValuePair<string, IEnumerable<string>>> Headers { get; }

#endregion

#region Public Constructors
Expand All @@ -23,9 +29,20 @@ public class EventSourceServiceUnsuccessfulResponseException : EventSourceServic
/// </summary>
/// <param name="statusCode">the HTTP status code of the response</param>
public EventSourceServiceUnsuccessfulResponseException(int statusCode) :
this(statusCode, new Dictionary<string, IEnumerable<string>>())
{
}

/// <summary>
/// Creates a new instance with headers.
/// </summary>
/// <param name="statusCode">the HTTP status code of the response</param>
/// <param name="headers">the HTTP headers from the response</param>
public EventSourceServiceUnsuccessfulResponseException(int statusCode, IEnumerable<KeyValuePair<string, IEnumerable<string>>> headers) :
base(string.Format(Resources.ErrorHttpStatus, statusCode))
{
StatusCode = statusCode;
Headers = headers ?? new Dictionary<string, IEnumerable<string>>();
}

#endregion
Expand Down
Loading