Skip to content

Commit 7f23c67

Browse files
committed
fix: credentials for multipart for cross-origin
1 parent 7bde143 commit 7f23c67

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/services/api/streaming.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type {AxiosWrapperOptions} from '@gravity-ui/axios-wrapper';
12
import {parseMultipart} from '@mjackson/multipart-parser';
23
import qs from 'qs';
34

@@ -28,6 +29,14 @@ export interface StreamQueryOptions {
2829
}
2930

3031
export class StreamingAPI extends BaseYdbAPI {
32+
withCredentials?: boolean;
33+
34+
constructor(options: AxiosWrapperOptions) {
35+
super(options);
36+
37+
this.withCredentials = options.config?.withCredentials;
38+
}
39+
3140
async streamQuery<Action extends Actions>(
3241
params: StreamQueryParams<Action>,
3342
options: StreamQueryOptions,
@@ -64,6 +73,7 @@ export class StreamingAPI extends BaseYdbAPI {
6473
method: 'POST',
6574
signal: options.signal,
6675
headers,
76+
credentials: this.withCredentials ? 'include' : undefined,
6777
body: JSON.stringify(body),
6878
});
6979

0 commit comments

Comments
 (0)