feat(fromFetch): add Server-Sent Events supports
**Description:**
Extends `fromFetch` function to enable Server-Sent Events.
```ts
import { fromFetch } from 'rxjs/fetch';
// URL_WITH_STREAM_MODE = "…";
// REQUEST_BODY = {…};
const data$ = fromFetch(URL_WITH_STREAM_MODE, {
selector: 'sse'
method: "POST",
body: JSON.stringify(REQUEST_BODY),
mode: "cors",
credentials: "include",
headers: {
"Content-Type": "application/json",
"Accept": "text/event-stream, application/json"
},
});
data$.subscribe({
next: result => console.log(result),
complete: () => console.log('done')
});
```
**Related issue:**
Discussion #7584
合并状态:未合并 1 条评论