File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
sdks/typescript/packages/client/src/transform Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -52,17 +52,20 @@ export const parseSSEStream = (source$: Observable<HttpEvent>): Observable<any>
5252 /**
5353 * Helper function to process an SSE event.
5454 * Extracts and joins data lines, then parses the result as JSON.
55- * Follows the SSE spec by only processing 'data:' prefixed lines.
55+ *
56+ * Follows the SSE spec by processing lines starting with 'data:',
57+ * ignoring a single space if it is present after the colon.
58+ *
5659 * @param eventText The raw event text to process
5760 */
5861 function processSSEEvent ( eventText : string ) {
5962 const lines = eventText . split ( "\n" ) ;
6063 const dataLines : string [ ] = [ ] ;
6164
6265 for ( const line of lines ) {
63- if ( line . startsWith ( "data: " ) ) {
64- // Extract data content (remove 'data: ' prefix)
65- dataLines . push ( line . slice ( 6 ) ) ;
66+ if ( line . startsWith ( "data:" ) ) {
67+ // Remove 'data:' prefix, and optionally a single space afterwards
68+ dataLines . push ( line . slice ( 5 ) . replace ( / ^ / , "" ) ) ;
6669 }
6770 }
6871
You can’t perform that action at this time.
0 commit comments