@@ -30,16 +30,14 @@ const validatePositiveInteger = (name: string, n: unknown): number => {
30
30
const appendBodyToFormData = ( formData : FormData , body : Record < string , any > ) : void => {
31
31
for ( const [ key , value ] of Object . entries ( body ) ) {
32
32
if ( Array . isArray ( value ) ) {
33
- value . forEach ( item => formData . append ( key , item ) ) ;
33
+ value . forEach ( ( item ) => formData . append ( key , item ) ) ;
34
34
} else {
35
35
formData . append ( key , value ) ;
36
36
}
37
37
}
38
- }
38
+ } ;
39
39
40
- export type FilePathOrFileObject =
41
- | string
42
- | File ;
40
+ export type FilePathOrFileObject = string | File ;
43
41
44
42
function makeFormDataFromFilePath ( filePath : string ) : FormData {
45
43
const formData = new FormData ( ) ;
@@ -97,7 +95,6 @@ export abstract class APIClient {
97
95
upload < Req , Rsp > ( path : string , file : string , opts ?: RequestOptions < Req > ) : Promise < Rsp > ;
98
96
upload < Req , Rsp > ( path : string , file : File , opts ?: RequestOptions < Req > ) : Promise < Rsp > ;
99
97
100
-
101
98
upload < Req , Rsp > ( path : string , file : FilePathOrFileObject , opts ?: RequestOptions < Req > ) : Promise < Rsp > {
102
99
let formData : FormData ;
103
100
@@ -113,10 +110,10 @@ export abstract class APIClient {
113
110
// eslint-disable-next-line @typescript-eslint/no-explicit-any
114
111
appendBodyToFormData ( formData , opts . body as Record < string , any > ) ;
115
112
}
116
-
113
+
117
114
const headers = {
118
115
...opts ?. headers ,
119
- 'Content-Type' : `multipart/form-data; boundary=${ formData . getBoundary ( ) } `
116
+ 'Content-Type' : `multipart/form-data; boundary=${ formData . getBoundary ( ) } ` ,
120
117
} ;
121
118
122
119
const options : FinalRequestOptions = {
@@ -126,9 +123,7 @@ export abstract class APIClient {
126
123
headers,
127
124
} ;
128
125
129
- return this . performRequest ( options ) . then (
130
- ( response ) => this . fetch . handleResponse < Rsp > ( response ) as Rsp ,
131
- ) ;
126
+ return this . performRequest ( options ) . then ( ( response ) => this . fetch . handleResponse < Rsp > ( response ) as Rsp ) ;
132
127
}
133
128
134
129
protected makeFormDataRequest < Req > (
@@ -194,7 +189,7 @@ export abstract class APIClient {
194
189
const options = {
195
190
method,
196
191
path,
197
-
192
+
198
193
...opts ,
199
194
} ;
200
195
0 commit comments