Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -1302,9 +1302,10 @@
// or 'LOADING' - meaning that stuff is happening
return 'uploading';
} else {
if (this.xhr.status == 200 || this.xhr.status == 202) {
if (this.xhr.status == 200 || this.xhr.status == 201 || this.xhr.status == 202) {
// HTTP 200, perfect
// HTTP 202 Accepted - The request has been accepted for processing, but the processing has not been completed.
// HTTP 201, Created - The request has been fulfilled and resulted in a new resource (in this case the file) being created.
// HTTP 202, Accepted - The request has been accepted for processing, but the processing has not been completed.
return 'success';
} else if (this.flowObj.opts.permanentErrors.indexOf(this.xhr.status) > -1 ||
this.retries >= this.flowObj.opts.maxChunkRetries) {
Expand Down
6 changes: 3 additions & 3 deletions test/uploadSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ describe('upload file', function() {
expect(requests[i]).toBeDefined();
expect(file.isComplete()).toBeFalsy();
expect(file.isUploading()).toBeTruthy();
requests[i].respond(200);
requests[i].respond(202);
expect(file.progress()).toBe((i+1) / 10);
expect(file.isComplete()).toBeFalsy();
expect(file.isUploading()).toBeTruthy();
Expand All @@ -85,7 +85,7 @@ describe('upload file', function() {
expect(file.isComplete()).toBeFalsy();
expect(file.isUploading()).toBeTruthy();
expect(file.progress()).toBe(0.9);
requests[i].respond(200);
requests[i].respond(201);
expect(file.isComplete()).toBeTruthy();
expect(file.isUploading()).toBeFalsy();
expect(file.progress()).toBe(1);
Expand Down Expand Up @@ -484,4 +484,4 @@ describe('upload file', function() {
expect(fileThird.timeRemaining()).toBe(0);
expect(flow.timeRemaining()).toBe(0);
});
});
});