Skip to content

Commit

Permalink
Tweak the status codes accoding to the front end code
Browse files Browse the repository at this point in the history
  • Loading branch information
williamdes committed Dec 3, 2023
1 parent 4dead44 commit d06de98
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Resumable.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ private function createSafeFilename(string $filename, string $originalFilename):
/**
* @return ResponseInterface
* @see https://github.com/23/resumable.js/blob/v1.1.0/README.md#handling-get-or-test-requests
* - If this request returns a 200 HTTP code, the chunks is assumed to have been completed.
* - If this request returns a 200 or 201 HTTP code, the chunks is assumed to have been completed.
* - If the request returns anything else, the chunk will be uploaded in the standard fashion.
* (It is recommended to return 204 No Content in these cases if possible
* to avoid unwarranted notices in browser consoles.)
Expand All @@ -248,9 +248,9 @@ public function handleTestChunk()
$chunkNumber = (int) $this->resumableParam($this->resumableOption['chunkNumber']);

if (! $this->isChunkUploaded($identifier, $filename, $chunkNumber)) {
return $this->response->withStatus(204);
} else {
return $this->response->withStatus(200);
} else {
return $this->response->withStatus(201);
}
}

Expand Down Expand Up @@ -284,7 +284,7 @@ public function handleChunk()
$this->log('Upload of ' . $identifier . ' is complete');
}

return $this->response->withStatus(200);
return $this->response->withStatus(201);
}

/**
Expand Down

0 comments on commit d06de98

Please sign in to comment.