@@ -168,6 +168,13 @@ export default class ChunkUploadHandler {
168
168
*/
169
169
pause ( ) {
170
170
this . file . active = false
171
+ this . stopChunks ( )
172
+ }
173
+
174
+ /**
175
+ * Stops all the current chunks
176
+ */
177
+ stopChunks ( ) {
171
178
this . chunksUploading . forEach ( chunk => {
172
179
chunk . xhr . abort ( )
173
180
chunk . active = false
@@ -208,7 +215,7 @@ export default class ChunkUploadHandler {
208
215
start ( ) {
209
216
request ( {
210
217
method : 'POST' ,
211
- headers : Object . assign ( this . headers , {
218
+ headers : Object . assign ( { } , this . headers , {
212
219
'Content-Type' : 'application/json'
213
220
} ) ,
214
221
url : this . action ,
@@ -275,9 +282,7 @@ export default class ChunkUploadHandler {
275
282
this . updateFileProgress ( )
276
283
chunk . xhr = createRequest ( {
277
284
method : 'POST' ,
278
- headers : Object . assign ( this . headers , {
279
- 'Content-Type' : 'multipart/form-data'
280
- } ) ,
285
+ headers : this . headers ,
281
286
url : this . action
282
287
} )
283
288
@@ -298,7 +303,7 @@ export default class ChunkUploadHandler {
298
303
chunk . uploaded = true
299
304
} else {
300
305
if ( chunk . retries -- <= 0 ) {
301
- this . pause ( )
306
+ this . stopChunks ( )
302
307
return this . reject ( 'upload' )
303
308
}
304
309
}
@@ -307,7 +312,7 @@ export default class ChunkUploadHandler {
307
312
} ) . catch ( ( ) => {
308
313
chunk . active = false
309
314
if ( chunk . retries -- <= 0 ) {
310
- this . pause ( )
315
+ this . stopChunks ( )
311
316
return this . reject ( 'upload' )
312
317
}
313
318
@@ -324,7 +329,7 @@ export default class ChunkUploadHandler {
324
329
325
330
request ( {
326
331
method : 'POST' ,
327
- headers : Object . assign ( this . headers , {
332
+ headers : Object . assign ( { } , this . headers , {
328
333
'Content-Type' : 'application/json'
329
334
} ) ,
330
335
url : this . action ,
0 commit comments