Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devolver Status 404 en los métodos GET PUT DELETE #1694

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions Core/Lib/API/APIModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class APIModel extends APIResourceClass
public function doDELETE(): bool
{
if (empty($this->params) || false === $this->model->loadFromCode($this->params[0])) {
$this->setError(Tools::lang()->trans('record-not-found'));
$this->setError(Tools::lang()->trans('record-not-found'), null, Response::HTTP_NOT_FOUND);
return false;
}

Expand Down Expand Up @@ -90,7 +90,7 @@ public function doGET(): bool

// record not found
if (false === $this->model->loadFromCode($this->params[0])) {
$this->setError(Tools::lang()->trans('record-not-found'));
$this->setError(Tools::lang()->trans('record-not-found'), null, Response::HTTP_NOT_FOUND);
return false;
}

Expand Down Expand Up @@ -138,7 +138,7 @@ public function doPUT(): bool
$param0 = empty($this->params) ? '' : $this->params[0];
$code = $values[$field] ?? $param0;
if (false === $this->model->loadFromCode($code)) {
$this->setError(Tools::lang()->trans('record-not-found'));
$this->setError(Tools::lang()->trans('record-not-found'), null, Response::HTTP_NOT_FOUND);
return false;
} elseif (empty($values)) {
$this->setError(Tools::lang()->trans('no-data-received-form'));
Expand Down