-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: request download and upload not support
responseReturn
(#5456)
* fix: request download and upload not support `responseReturn` * docs: update * fix: type of request client upload result
- Loading branch information
Showing
7 changed files
with
93 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 22 additions & 12 deletions
34
packages/effects/request/src/request-client/modules/downloader.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import type { RequestResponse } from '@vben/request'; | ||
|
||
import { requestClient } from '../request'; | ||
|
||
/** | ||
* 下载文件,获取Blob | ||
* @returns Blob | ||
*/ | ||
async function downloadFile1() { | ||
return requestClient.download<Blob>( | ||
'https://unpkg.com/@vbenjs/static-source@0.1.7/source/logo-v1.webp', | ||
); | ||
} | ||
|
||
/** | ||
* 下载文件,获取完整的Response | ||
* @returns RequestResponse<Blob> | ||
*/ | ||
async function downloadFile2() { | ||
return requestClient.download<RequestResponse<Blob>>( | ||
'https://unpkg.com/@vbenjs/static-source@0.1.7/source/logo-v1.webp', | ||
{ | ||
responseReturn: 'raw', | ||
}, | ||
); | ||
} | ||
|
||
export { downloadFile1, downloadFile2 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters