@@ -168,9 +168,14 @@ export const getFetch: NodeTaskFactory<NodeInfo> = (
168168 mode : 'cors' ,
169169 } )
170170 . then ( async ( response ) => {
171+ const contentType = response . headers . get ( 'content-type' ) ;
172+
171173 if (
172174 response . body instanceof ReadableStream &&
173- responseType !== 'text'
175+ responseType !== 'text' &&
176+ contentType &&
177+ ( contentType . includes ( 'application/stream+json' ) ||
178+ contentType . includes ( 'text/event-stream' ) )
174179 ) {
175180 const reader = response . body . getReader ( ) ;
176181 let isFullJson = false ;
@@ -201,23 +206,23 @@ export const getFetch: NodeTaskFactory<NodeInfo> = (
201206
202207 console . log ( 'chunkString' , chunkString . split ( '\n\n' ) ) ;
203208 //const chunks = chunkString.split('\n\n');
204- if ( chunkString . endsWith ( '}\n' ) ) {
205- try {
206- const json = JSON . parse ( chunkString ) ;
207- isFullJson = true ;
208- sendFetchResult ( json ) . then ( ( ) => {
209- resolve ( {
210- result : false ,
211- followPath : undefined ,
212- stop : true ,
213- dummyEndpoint : true ,
214- } ) ;
209+ //if (chunkString.endsWith(' }\n')) {
210+ try {
211+ const json = JSON . parse ( chunkString ) ;
212+ isFullJson = true ;
213+ sendFetchResult ( json ) . then ( ( ) => {
214+ resolve ( {
215+ result : false ,
216+ followPath : undefined ,
217+ stop : true ,
218+ dummyEndpoint : true ,
215219 } ) ;
216- hideLoader ( ) ;
217- } catch ( error ) {
218- isFullJson = false ;
219- }
220+ } ) ;
221+ hideLoader ( ) ;
222+ } catch ( error ) {
223+ isFullJson = false ;
220224 }
225+ //}
221226
222227 if ( ! isFullJson ) {
223228 const lines = chunkString
@@ -253,7 +258,11 @@ export const getFetch: NodeTaskFactory<NodeInfo> = (
253258 } ;
254259
255260 readChunk ( ) ;
256- } else if ( responseType === 'json' ) {
261+ } else if (
262+ responseType === 'json' &&
263+ contentType &&
264+ contentType . includes ( 'application/json' )
265+ ) {
257266 response . json ( ) . then ( ( json ) => {
258267 sendFetchState ( 'ready' ) ;
259268 result = json ;
@@ -370,7 +379,7 @@ export const getFetch: NodeTaskFactory<NodeInfo> = (
370379 x ,
371380 y ,
372381 width ?? 200 ,
373- height ?? 100 ,
382+ height ?? 200 ,
374383 undefined ,
375384 [
376385 {
0 commit comments