stevenroose / dart-eventsource

A client and server implementation of Server-Side Events.
MIT License
56 stars 49 forks source link

Added the ability to add custom headers to the EventSource http request #11

Closed robin7331 closed 4 years ago

robin7331 commented 4 years ago

I ran into a problem where I'd like to connect to an Event Source which was behind an Endpoint that required Authorization.

So I added the optional headers attribute to the connect factory. It accepts a Map and merges all its entries with the already present headers of this library.

EventSource eventSource = await EventSource.connect( url, client: httpClient, headers: { "Authorization": "Bearer ..." }, );

stevenroose commented 4 years ago

Awesome!

stevenroose commented 4 years ago

Released v0.2.2.

robin7331 commented 4 years ago

Pretty cool!