@@ -563,10 +563,13 @@ <h2 class="font-medium text-accent">🔥 Stress Test</h2>
563563 const code = cm . getValue ( ) . trim ( ) ;
564564 if ( ! code ) return { } ;
565565
566+ // Server requires `type` alongside `code` (CrawlerRunConfig | BrowserConfig).
567+ // The UI already tracks this in #cfg-type; omitting it always 400s Advanced Config.
568+ const cfgType = document . getElementById ( 'cfg-type' ) . value ;
566569 const res = await authFetch ( '/config/dump' , {
567570 method : 'POST' ,
568571 headers : { 'Content-Type' : 'application/json' } ,
569- body : JSON . stringify ( { code } ) ,
572+ body : JSON . stringify ( { type : cfgType , code } ) ,
570573 } ) ;
571574
572575 const statusEl = document . getElementById ( 'cfg-status' ) ;
@@ -652,9 +655,12 @@ <h2 class="font-medium text-accent">🔥 Stress Test</h2>
652655 // Detect if stream is requested inside payload
653656 function shouldUseStream ( payload ) {
654657 const toBool = ( v ) => v === true || ( typeof v === 'string' && v . toLowerCase ( ) === 'true' ) ;
655- const fromCrawler = payload && payload . crawler_config && payload . crawler_config . params && payload . crawler_config . params . stream ;
658+ // Successful /config/dump returns { type, params: { stream, ... } }
659+ const fromCrawlerParams = payload && payload . crawler_config && payload . crawler_config . params && payload . crawler_config . params . stream ;
660+ // Fallback / minimal shapes may set stream at the crawler_config top level
661+ const fromCrawlerTop = payload && payload . crawler_config && payload . crawler_config . stream ;
656662 const direct = payload && payload . stream ;
657- return toBool ( fromCrawler ) || toBool ( direct ) ;
663+ return toBool ( fromCrawlerParams ) || toBool ( fromCrawlerTop ) || toBool ( direct ) ;
658664 }
659665
660666 // Main run function
@@ -676,8 +682,8 @@ <h2 class="font-medium text-accent">🔥 Stress Test</h2>
676682 const streamFlag = / s t r e a m \s * = \s * T r u e / i. test ( codeText ) ;
677683 const isCrawlEndpoint = document . getElementById ( 'endpoint' ) . value === 'crawl' ;
678684 if ( isCrawlEndpoint && streamFlag ) {
679- // Fallback: proceed with minimal config only for stream
680- advConfig = { crawler_config : { stream : true } } ;
685+ // Fallback: minimal dump-shaped config so shouldUseStream + server load agree
686+ advConfig = { crawler_config : { type : 'CrawlerRunConfig' , params : { stream : true } } } ;
681687 } else {
682688 updateStatus ( 'error' ) ;
683689 document . querySelector ( '#response-content code' ) . textContent =
0 commit comments