@@ -71,22 +71,19 @@ export abstract class APIClient {
71
71
) ;
72
72
}
73
73
74
- protected makeFormDataRequest < Req > (
75
- path : string ,
76
- filePath : string ,
77
- opts ?: RequestOptions < Req > ,
78
- ) : FinalRequestOptions {
74
+ protected makeFormDataRequest < Req > ( path : string , filePath : string , opts ?: RequestOptions < Req > ) : FinalRequestOptions {
79
75
const formData = new FormData ( ) ;
80
76
const fileStream = createReadStream ( filePath ) ;
81
77
const fileName = getBasename ( filePath ) ;
82
78
83
79
formData . append ( 'file' , fileStream , fileName ) ;
84
80
85
81
if ( opts ?. body ) {
86
- const body = opts . body as Record < string , string > ;
82
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
83
+ const body = opts . body as Record < string , any > ;
87
84
for ( const [ key , value ] of Object . entries ( body ) ) {
88
85
if ( Array . isArray ( value ) ) {
89
- value . forEach ( ( item ) => formData . append ( key , item ) ) ;
86
+ value . forEach ( item => formData . append ( key , item ) ) ;
90
87
} else {
91
88
formData . append ( key , value ) ;
92
89
}
@@ -95,12 +92,12 @@ export abstract class APIClient {
95
92
96
93
const headers = {
97
94
...opts ?. headers ,
98
- 'Content-Type' : `multipart/form-data; boundary=${ formData . getBoundary ( ) } ` ,
95
+ 'Content-Type' : `multipart/form-data; boundary=${ formData . getBoundary ( ) } `
99
96
} ;
100
97
console . log ( headers ) ;
101
- console . log ( ' -------------------------' ) ;
98
+ console . log ( " -------------------------" ) ;
102
99
console . log ( formData . getHeaders ( ) ) ;
103
- console . log ( ' -------------------------' ) ;
100
+ console . log ( " -------------------------" ) ;
104
101
105
102
const options : FinalRequestOptions = {
106
103
method : 'post' ,
0 commit comments