@@ -127,36 +127,34 @@ export const upload = (uploadOptions: UploadOptions): Promise<UploadResponse> =>
127127 for ( key in uploadOptions ) {
128128 if ( key ) {
129129 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 ) ) ;
131131 } else if ( key === "tags" && Array . isArray ( uploadOptions . tags ) ) {
132- formData . append ( 'tags' , uploadOptions . tags . join ( "," ) ) ;
132+ formData . set ( 'tags' , uploadOptions . tags . join ( "," ) ) ;
133133 } else if ( key === 'signature' ) {
134- formData . append ( "signature" , uploadOptions . signature ) ;
134+ formData . set ( "signature" , uploadOptions . signature ) ;
135135 } else if ( key === 'expire' ) {
136- formData . append ( "expire" , String ( uploadOptions . expire ) ) ;
136+ formData . set ( "expire" , String ( uploadOptions . expire ) ) ;
137137 } else if ( key === 'token' ) {
138- formData . append ( "token" , uploadOptions . token ) ;
138+ formData . set ( "token" , uploadOptions . token ) ;
139139 } else if ( key === "responseFields" && Array . isArray ( uploadOptions . responseFields ) ) {
140- formData . append ( 'responseFields' , uploadOptions . responseFields . join ( "," ) ) ;
140+ formData . set ( 'responseFields' , uploadOptions . responseFields . join ( "," ) ) ;
141141 } else if ( key === "extensions" && Array . isArray ( uploadOptions . extensions ) ) {
142- formData . append ( 'extensions' , JSON . stringify ( uploadOptions . extensions ) ) ;
142+ formData . set ( 'extensions' , JSON . stringify ( uploadOptions . extensions ) ) ;
143143 } else if ( key === "customMetadata" && typeof uploadOptions . customMetadata === "object" &&
144144 ! Array . isArray ( uploadOptions . customMetadata ) && uploadOptions . customMetadata !== null ) {
145- formData . append ( 'customMetadata' , JSON . stringify ( uploadOptions . customMetadata ) ) ;
145+ formData . set ( 'customMetadata' , JSON . stringify ( uploadOptions . customMetadata ) ) ;
146146 } else if ( key === "transformation" && typeof uploadOptions . transformation === "object" &&
147147 uploadOptions . transformation !== null ) {
148- formData . append ( key , JSON . stringify ( uploadOptions . transformation ) ) ;
148+ formData . set ( key , JSON . stringify ( uploadOptions . transformation ) ) ;
149149 } else if ( key === 'checks' && uploadOptions . checks ) {
150- formData . append ( "checks" , uploadOptions . checks ) ;
150+ formData . set ( "checks" , uploadOptions . checks ) ;
151151 } else if ( uploadOptions [ key ] !== undefined ) {
152152 if ( [ "onProgress" , "abortSignal" ] . includes ( key ) ) continue ;
153- formData . append ( key , String ( uploadOptions [ key ] ) ) ;
153+ formData . set ( key , String ( uploadOptions [ key ] ) ) ;
154154 }
155155 }
156156 }
157157
158- formData . append ( "publicKey" , uploadOptions . publicKey ) ;
159-
160158 if ( uploadOptions . onProgress ) {
161159 xhr . upload . onprogress = function ( event : ProgressEvent ) {
162160 if ( uploadOptions . onProgress ) uploadOptions . onProgress ( event )
0 commit comments