ITADN

feat(fromFetch): add Server-Sent Events supports

#7589Pull Requestkingcean 创建于 2026-01-04
K
kingceancommented
**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 条评论