Commit f6fadb0
zhaojing.jz
fix: check [DONE] SSE marker before deserialization in stream_mapped_raw_events
PR #537 refactored the streaming pipeline and removed reqwest-eventsource.
The old `stream()` function checked for the `[DONE]` SSE end-of-stream
marker *before* passing event data to `serde_json::from_str`. The
refactored version delegated to `stream_mapped_raw_events`, which checks
`[DONE]` *after* calling the `event_mapper` closure. Since the mapper in
`stream()` deserializes JSON, this causes `[DONE]` to fail with:
failed deserialization of: [DONE]
Move the `[DONE]` check before the mapper call in both the WASM
(futures::stream::unfold) and non-WASM (tokio::mpsc) implementations.
Closes #5421 parent b7fd7ea commit f6fadb0
1 file changed
Lines changed: 10 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
791 | 791 | | |
792 | 792 | | |
793 | 793 | | |
794 | | - | |
795 | | - | |
796 | | - | |
797 | | - | |
798 | | - | |
799 | | - | |
| 794 | + | |
| 795 | + | |
800 | 796 | | |
801 | 797 | | |
802 | 798 | | |
| |||
805 | 801 | | |
806 | 802 | | |
807 | 803 | | |
808 | | - | |
| 804 | + | |
809 | 805 | | |
810 | 806 | | |
811 | 807 | | |
812 | 808 | | |
813 | 809 | | |
814 | | - | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
815 | 813 | | |
816 | 814 | | |
817 | 815 | | |
818 | 816 | | |
819 | 817 | | |
820 | 818 | | |
821 | | - | |
| 819 | + | |
822 | 820 | | |
823 | 821 | | |
824 | 822 | | |
| |||
856 | 854 | | |
857 | 855 | | |
858 | 856 | | |
859 | | - | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
860 | 860 | | |
861 | 861 | | |
862 | 862 | | |
| |||
867 | 867 | | |
868 | 868 | | |
869 | 869 | | |
870 | | - | |
871 | | - | |
872 | | - | |
873 | | - | |
874 | 870 | | |
875 | 871 | | |
876 | 872 | | |
| |||
0 commit comments