-
Notifications
You must be signed in to change notification settings - Fork 17
feat: Report event source headers on open. #104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
|
|
||
| namespace LaunchDarkly.EventSource | ||
| { | ||
| /// <summary> | ||
| /// Event arguments for the EventSourceService opened event. | ||
| /// </summary> | ||
| internal class EventSourceOpenedEventArgs: EventArgs | ||
| { | ||
| /// <summary> | ||
| /// Construct new event arguments. | ||
| /// </summary> | ||
| /// <param name="headers">headers from the HTTP response</param> | ||
| public EventSourceOpenedEventArgs(IEnumerable<KeyValuePair<string, IEnumerable<string>>> headers) | ||
| { | ||
| Headers = headers; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Response headers from the underlying HTTP request. | ||
| /// </summary> | ||
| public IEnumerable<KeyValuePair<string,IEnumerable<string>>> Headers { get; } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
|
|
||
| namespace LaunchDarkly.EventSource | ||
| { | ||
|
|
@@ -16,13 +17,23 @@ public class StateChangedEventArgs : EventArgs | |
| /// </value> | ||
| public ReadyState ReadyState { get; } | ||
|
|
||
| /// <summary> | ||
| /// Get the response headers. Only populated for <see cref="ReadyState.Open"/>. | ||
| /// <value> | ||
| /// A collection of header values when the ReadyState is Open, or null. | ||
| /// </value> | ||
| /// </summary> | ||
| public IEnumerable<KeyValuePair<string,IEnumerable<string>>> Headers { get; } | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the public facing change. |
||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="StateChangedEventArgs"/> class. | ||
| /// </summary> | ||
| /// <param name="readyState">One of the <see cref="EventSource.ReadyState"/> values, which represents the state of the EventSource connection.</param> | ||
| public StateChangedEventArgs(ReadyState readyState) | ||
| /// <param name="headers">Response headers when the <see cref="StateChangedEventArgs.ReadyState"/> is <see cref="ReadyState.Open"/>. Otherwise null.</param> | ||
| public StateChangedEventArgs(ReadyState readyState, IEnumerable<KeyValuePair<string,IEnumerable<string>>> headers = null) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This constructor is public, but isn't something someone would really need to use in normal operation. Likely it should have been internal. |
||
| { | ||
| ReadyState = readyState; | ||
| Headers = headers; | ||
| } | ||
| } | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The EventSource service is internal, so there isn't any external impact from this change.