diff --git a/src/flow.js b/src/flow.js index f5feddfc..6b61fead 100644 --- a/src/flow.js +++ b/src/flow.js @@ -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) { diff --git a/test/uploadSpec.js b/test/uploadSpec.js index d7528ddc..4985a284 100644 --- a/test/uploadSpec.js +++ b/test/uploadSpec.js @@ -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(); @@ -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); @@ -484,4 +484,4 @@ describe('upload file', function() { expect(fileThird.timeRemaining()).toBe(0); expect(flow.timeRemaining()).toBe(0); }); -}); \ No newline at end of file +});