nervous-systems / kvlt

Multi-target Clojure/script HTTP client
The Unlicense
69 stars 8 forks source link

cannot use cookie with event-source! #27

Open loomis opened 7 years ago

loomis commented 7 years ago

We're using SSE with a server that requires authentication. Since our authentication token is handled via cookies, the ClojureScript call to event-source! works correctly because the cookie is added automatically to the request by the browser. For Clojure however, the cookie needs to be passed to the request explicitly because the Aleph client doesn't have a cookie store. Looking through the code, there is no way at the moment to add a cookie header to the event-source! request.

Would you be open to changing the implementation to pass a cookie value from event-source! to the underlying Clojure platform implementation? If so, I can try putting together a PR for this.

moea commented 7 years ago

@loomis I wouldn't be surprised if you're the only user of event-source! - feel free to submit the PR.

moea commented 7 years ago

(maybe being able to pass custom headers generally would be a cleaner solution)

loomis commented 7 years ago

@moea The PR is #28. I've added a unit test and done some other light testing. If you need something that needs fixing, let me know. If it looks ok, creating an updated 0.1.5 snapshot release would help us test more throughly.

moea commented 7 years ago

0.1.5-SNAPSHOT updated