@@ -9,7 +9,10 @@ import {
99import type { Actions , TracingLevel } from '../../types/api/query' ;
1010import type { QuerySyntax , StatisticsMode } from '../../types/store/query' ;
1111import type { QueryResponseChunk , SessionChunk , StreamDataChunk } from '../../types/store/streaming' ;
12- import { BINARY_DATA_IN_PLAIN_TEXT_DISPLAY } from '../../utils/constants' ;
12+ import {
13+ BINARY_DATA_IN_PLAIN_TEXT_DISPLAY ,
14+ DEV_ENABLE_TRACING_FOR_ALL_REQUESTS ,
15+ } from '../../utils/constants' ;
1316import { settingsManager } from '../settings' ;
1417
1518import { BaseYdbAPI } from './base' ;
@@ -45,22 +48,33 @@ export class StreamingAPI extends BaseYdbAPI {
4548 ) ;
4649
4750 const queryParams = qs . stringify (
48- { ... params , base64, schema : 'multipart' } ,
51+ { timeout : params . timeout , base64, schema : 'multipart' } ,
4952 { encoder : encodeURIComponent } ,
5053 ) ;
5154
55+ const body = { ...params , base64, schema : 'multipart' } ;
5256 const headers = new Headers ( {
53- Accept : 'multipart/x-mixed-replace' ,
57+ Accept : 'multipart/form-data' ,
58+ 'Content-Type' : 'application/json' ,
5459 } ) ;
5560
5661 if ( params . tracingLevel ) {
5762 headers . set ( 'X-Trace-Verbosity' , String ( params . tracingLevel ) ) ;
5863 }
5964
65+ const enableTracing = settingsManager . readUserSettingsValue (
66+ DEV_ENABLE_TRACING_FOR_ALL_REQUESTS ,
67+ ) ;
68+
69+ if ( enableTracing ) {
70+ headers . set ( 'X-Want-Trace' , '1' ) ;
71+ }
72+
6073 const response = await fetch ( `${ this . getPath ( '/viewer/query' ) } ?${ queryParams } ` , {
61- method : 'GET ' ,
74+ method : 'POST ' ,
6275 signal : options . signal ,
6376 headers,
77+ body : JSON . stringify ( body ) ,
6478 } ) ;
6579
6680 if ( ! response . ok ) {
0 commit comments