@@ -127,36 +127,34 @@ export const upload = (uploadOptions: UploadOptions): Promise<UploadResponse> =>
127
127
for ( key in uploadOptions ) {
128
128
if ( key ) {
129
129
if ( key === "file" && typeof uploadOptions . file != "string" ) {
130
- formData . append ( 'file' , uploadOptions . file , String ( uploadOptions . fileName ) ) ;
130
+ formData . set ( 'file' , uploadOptions . file , String ( uploadOptions . fileName ) ) ;
131
131
} else if ( key === "tags" && Array . isArray ( uploadOptions . tags ) ) {
132
- formData . append ( 'tags' , uploadOptions . tags . join ( "," ) ) ;
132
+ formData . set ( 'tags' , uploadOptions . tags . join ( "," ) ) ;
133
133
} else if ( key === 'signature' ) {
134
- formData . append ( "signature" , uploadOptions . signature ) ;
134
+ formData . set ( "signature" , uploadOptions . signature ) ;
135
135
} else if ( key === 'expire' ) {
136
- formData . append ( "expire" , String ( uploadOptions . expire ) ) ;
136
+ formData . set ( "expire" , String ( uploadOptions . expire ) ) ;
137
137
} else if ( key === 'token' ) {
138
- formData . append ( "token" , uploadOptions . token ) ;
138
+ formData . set ( "token" , uploadOptions . token ) ;
139
139
} else if ( key === "responseFields" && Array . isArray ( uploadOptions . responseFields ) ) {
140
- formData . append ( 'responseFields' , uploadOptions . responseFields . join ( "," ) ) ;
140
+ formData . set ( 'responseFields' , uploadOptions . responseFields . join ( "," ) ) ;
141
141
} else if ( key === "extensions" && Array . isArray ( uploadOptions . extensions ) ) {
142
- formData . append ( 'extensions' , JSON . stringify ( uploadOptions . extensions ) ) ;
142
+ formData . set ( 'extensions' , JSON . stringify ( uploadOptions . extensions ) ) ;
143
143
} else if ( key === "customMetadata" && typeof uploadOptions . customMetadata === "object" &&
144
144
! Array . isArray ( uploadOptions . customMetadata ) && uploadOptions . customMetadata !== null ) {
145
- formData . append ( 'customMetadata' , JSON . stringify ( uploadOptions . customMetadata ) ) ;
145
+ formData . set ( 'customMetadata' , JSON . stringify ( uploadOptions . customMetadata ) ) ;
146
146
} else if ( key === "transformation" && typeof uploadOptions . transformation === "object" &&
147
147
uploadOptions . transformation !== null ) {
148
- formData . append ( key , JSON . stringify ( uploadOptions . transformation ) ) ;
148
+ formData . set ( key , JSON . stringify ( uploadOptions . transformation ) ) ;
149
149
} else if ( key === 'checks' && uploadOptions . checks ) {
150
- formData . append ( "checks" , uploadOptions . checks ) ;
150
+ formData . set ( "checks" , uploadOptions . checks ) ;
151
151
} else if ( uploadOptions [ key ] !== undefined ) {
152
152
if ( [ "onProgress" , "abortSignal" ] . includes ( key ) ) continue ;
153
- formData . append ( key , String ( uploadOptions [ key ] ) ) ;
153
+ formData . set ( key , String ( uploadOptions [ key ] ) ) ;
154
154
}
155
155
}
156
156
}
157
157
158
- formData . append ( "publicKey" , uploadOptions . publicKey ) ;
159
-
160
158
if ( uploadOptions . onProgress ) {
161
159
xhr . upload . onprogress = function ( event : ProgressEvent ) {
162
160
if ( uploadOptions . onProgress ) uploadOptions . onProgress ( event )
0 commit comments