Skip to content

Commit

Permalink
fix: #20002 optimize head request on serializeDataProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
Akbar Herlambang committed Oct 14, 2023
1 parent 4fe40f9 commit 3014fa2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions framework/rest/Serializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,20 +188,20 @@ protected function getRequestedFields()
*/
protected function serializeDataProvider($dataProvider)
{
if (($pagination = $dataProvider->getPagination()) !== false) {
$this->addPaginationHeaders($pagination);
}
if ($this->request->getIsHead()) {
return null;
}
if ($this->preserveKeys) {
$models = $dataProvider->getModels();
} else {
$models = array_values($dataProvider->getModels());
}
$models = $this->serializeModels($models);

if (($pagination = $dataProvider->getPagination()) !== false) {
$this->addPaginationHeaders($pagination);
}

if ($this->request->getIsHead()) {
return null;
} elseif ($this->collectionEnvelope === null) {
if ($this->collectionEnvelope === null) {
return $models;
}

Expand Down

0 comments on commit 3014fa2

Please sign in to comment.