Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
monorepo
/
venus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 88d2b3e5
authored
Oct 21, 2024
by
Svend
Committed by
GitHub
Oct 21, 2024
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat(@vben/request): export basic HttpResponse generic (#4697)
1 parent
625862e0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
packages/effects/request/src/request-client/modules/downloader.ts
packages/effects/request/src/request-client/types.ts
packages/effects/request/src/request-client/modules/downloader.ts
View file @
88d2b3e
import
type
{
AxiosRequestConfig
,
AxiosResponse
}
from
'axios'
;
import
type
{
AxiosRequestConfig
}
from
'axios'
;
import
type
{
RequestClient
}
from
'../request-client'
;
import
type
{
RequestClient
}
from
'../request-client'
;
import
type
{
RequestResponse
}
from
'../types'
;
class
FileDownloader
{
class
FileDownloader
{
private
client
:
RequestClient
;
private
client
:
RequestClient
;
...
@@ -12,13 +13,13 @@ class FileDownloader {
...
@@ -12,13 +13,13 @@ class FileDownloader {
public
async
download
(
public
async
download
(
url
:
string
,
url
:
string
,
config
?:
AxiosRequestConfig
,
config
?:
AxiosRequestConfig
,
):
Promise
<
Axios
Response
<
Blob
>>
{
):
Promise
<
Request
Response
<
Blob
>>
{
const
finalConfig
:
AxiosRequestConfig
=
{
const
finalConfig
:
AxiosRequestConfig
=
{
...
config
,
...
config
,
responseType
:
'blob'
,
responseType
:
'blob'
,
};
};
const
response
=
await
this
.
client
.
get
<
Axios
Response
<
Blob
>>
(
const
response
=
await
this
.
client
.
get
<
Request
Response
<
Blob
>>
(
url
,
url
,
finalConfig
,
finalConfig
,
);
);
...
...
packages/effects/request/src/request-client/types.ts
View file @
88d2b3e
...
@@ -4,6 +4,8 @@ import type {
...
@@ -4,6 +4,8 @@ import type {
InternalAxiosRequestConfig
,
InternalAxiosRequestConfig
,
}
from
'axios'
;
}
from
'axios'
;
type
RequestResponse
<
T
=
any
>
=
AxiosResponse
<
T
>
;
type
RequestContentType
=
type
RequestContentType
=
|
'application/json;charset=utf-8'
|
'application/json;charset=utf-8'
|
'application/octet-stream;charset=utf-8'
|
'application/octet-stream;charset=utf-8'
...
@@ -46,5 +48,6 @@ export type {
...
@@ -46,5 +48,6 @@ export type {
RequestClientOptions
,
RequestClientOptions
,
RequestContentType
,
RequestContentType
,
RequestInterceptorConfig
,
RequestInterceptorConfig
,
RequestResponse
,
ResponseInterceptorConfig
,
ResponseInterceptorConfig
,
};
};
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment