5
0
Fork 0

fix: authToken handling

master
Sudharshan S. 2019-03-23 23:32:21 +08:00
parent 5ab96112ea
commit 0368fb1fc3
Signed by: sudharshan
GPG Key ID: C861C97AAF3D9559
1 changed files with 5 additions and 3 deletions

View File

@ -34,7 +34,7 @@ class EventSource extends Stream<Event> {
// interface attributes // interface attributes
final Uri url; final Uri url;
final String authToken; String authToken = "";
EventSourceReadyState get readyState => _readyState; EventSourceReadyState get readyState => _readyState;
@ -61,12 +61,14 @@ class EventSource extends Stream<Event> {
url = url is Uri ? url : Uri.parse(url); url = url is Uri ? url : Uri.parse(url);
client = client ?? new http.Client(); client = client ?? new http.Client();
lastEventId = lastEventId ?? ""; lastEventId = lastEventId ?? "";
EventSource es = new EventSource._internal(url, client, lastEventId); EventSource es =
new EventSource._internal(url, client, lastEventId, authToken);
await es._start(); await es._start();
return es; return es;
} }
EventSource._internal(this.url, this.client, this._lastEventId) { EventSource._internal(
this.url, this.client, this._lastEventId, this.authToken) {
_decoder = new EventSourceDecoder(retryIndicator: _updateRetryDelay); _decoder = new EventSourceDecoder(retryIndicator: _updateRetryDelay);
} }