File tree Expand file tree Collapse file tree
webapp/packages/core-utils/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -89,3 +89,4 @@ export * from './bindFunctions.js';
8989export * from './isNumber.js' ;
9090export * from './getSubjectDifferences.js' ;
9191export * from './downloadImage.js' ;
92+ export * from './postForBlob.js' ;
Original file line number Diff line number Diff line change 1+ /*
2+ * CloudBeaver - Cloud Database Manager
3+ * Copyright (C) 2020-2026 DBeaver Corp and others
4+ *
5+ * Licensed under the Apache License, Version 2.0.
6+ * you may not use this file except in compliance with the License.
7+ */
8+
9+ export async function postForBlob ( url : string , payload : unknown ) : Promise < Blob > {
10+ const response = await fetch ( url , {
11+ method : 'POST' ,
12+ credentials : 'include' ,
13+ headers : { 'Content-Type' : 'application/json' } ,
14+ body : JSON . stringify ( payload ) ,
15+ } ) ;
16+
17+ if ( ! response . ok ) {
18+ throw new Error ( `Request failed: ${ response . status } ${ response . statusText } ` ) ;
19+ }
20+
21+ return await response . blob ( ) ;
22+ }
You can’t perform that action at this time.
0 commit comments