capacitor
capacitor copied to clipboard
bug: CapacitorHttp - No support for Server-Sent Events (EventSource API)
Bug Report
Capacitor Version
@capacitor/cli: 4.7.0 @capacitor/core: 4.7.0 @capacitor/ios: 4.7.0 @capacitor/android: 4.7.0
Platform(s)
iOS and Android regardless of version
Current Behavior
When using the web's EventSource
API for use with Server-Sent Events, the CapacitorHttp plugin won't be used and instead it falls back to the web's native implementation. This is caused CORS issues when intending to use device's native HTTP handling (hence the usage of CapacitorHttp).
Expected Behavior
As with fetch
and XMLHttpRequest
, EventSource
should also be patched and work through device native events.
Additional Context
Likely related to other issues similar to this since the Content-Type
is text/event-stream
for Server-Sent events: https://github.com/ionic-team/capacitor/issues/6299 & https://github.com/ionic-team/capacitor/pull/6206 ?