@@ -4,8 +4,8 @@ import { buildUrl } from "./buildUrl";
44
55export const buildRequestConfig = < T = UnData , D = UnData > (
66 config : UnConfig < T , D > ,
7- ) =>
8- ( {
7+ ) : UniApp . RequestOptions => {
8+ const result = {
99 url : buildUrl (
1010 buildFullPath (
1111 config . baseUrl ?? "" ,
@@ -21,14 +21,26 @@ export const buildRequestConfig = <T = UnData, D = UnData>(
2121 timeout : config . timeout ,
2222 dataType : config . dataType ,
2323 responseType : config . responseType ,
24+ sslVerify : config . sslVerify ,
25+ withCredentials : config . withCredentials ,
26+ firstIpv4 : config . firstIpv4 ,
2427 enableHttp2 : config . enableHttp2 ,
2528 enableQuic : config . enableQuic ,
2629 enableCache : config . enableCache ,
2730 enableHttpDNS : config . enableHttpDNS ,
2831 httpDNSServiceId : config . httpDNSServiceId ,
2932 enableChunked : config . enableChunked ,
3033 forceCellularNetwork : config . forceCellularNetwork ,
31- sslVerify : config . sslVerify ,
32- withCredentials : config . withCredentials ,
33- firstIpv4 : config . firstIpv4 ,
34- } ) as UniApp . RequestOptions ;
34+ enableCookie : config . enableCookie ,
35+ cloudCache : config . cloudCache ,
36+ defer : config . defer ,
37+ } ;
38+
39+ const entries = Object . entries ( result ) as [
40+ keyof typeof result ,
41+ ( typeof result ) [ keyof typeof result ] ,
42+ ] [ ] ;
43+ return Object . fromEntries (
44+ entries . filter ( ( [ k ] ) => result [ k ] != null ) ,
45+ ) as unknown as UniApp . RequestOptions ;
46+ } ;
0 commit comments