!16 让http工具方法支持传递更多参数

Merge pull request !16 from 浑宣凯/N/A
This commit is contained in:
菲鸽 2025-06-15 12:50:45 +00:00 committed by feige996
parent bd64215f86
commit 3808f515cf

View File

@ -53,12 +53,14 @@ export const httpGet = <T>(
url: string, url: string,
query?: Record<string, any>, query?: Record<string, any>,
header?: Record<string, any>, header?: Record<string, any>,
options?: Partial<CustomRequestOptions>,
) => { ) => {
return http<T>({ return http<T>({
url, url,
query, query,
method: 'GET', method: 'GET',
header, header,
...options,
}) })
} }
@ -75,6 +77,7 @@ export const httpPost = <T>(
data?: Record<string, any>, data?: Record<string, any>,
query?: Record<string, any>, query?: Record<string, any>,
header?: Record<string, any>, header?: Record<string, any>,
options?: Partial<CustomRequestOptions>,
) => { ) => {
return http<T>({ return http<T>({
url, url,
@ -82,6 +85,7 @@ export const httpPost = <T>(
data, data,
method: 'POST', method: 'POST',
header, header,
...options,
}) })
} }
/** /**
@ -92,6 +96,7 @@ export const httpPut = <T>(
data?: Record<string, any>, data?: Record<string, any>,
query?: Record<string, any>, query?: Record<string, any>,
header?: Record<string, any>, header?: Record<string, any>,
options?: Partial<CustomRequestOptions>,
) => { ) => {
return http<T>({ return http<T>({
url, url,
@ -99,6 +104,7 @@ export const httpPut = <T>(
query, query,
method: 'PUT', method: 'PUT',
header, header,
...options,
}) })
} }
@ -109,12 +115,14 @@ export const httpDelete = <T>(
url: string, url: string,
query?: Record<string, any>, query?: Record<string, any>,
header?: Record<string, any>, header?: Record<string, any>,
options?: Partial<CustomRequestOptions>,
) => { ) => {
return http<T>({ return http<T>({
url, url,
query, query,
method: 'DELETE', method: 'DELETE',
header, header,
...options,
}) })
} }