Closed alexwbaule closed 3 months ago
this https://github.com/opnsense/core/commit/f3669a58d778afde7ed41b6822c9ebd5a3e34c5c should fix the issue, looks like I forgot about this one. thanks for reporting.
Tks @AdSchellevis !
in my install i create this function, on update this is will be overwriten, its ok.
public function setJsonContent(mixed $content): void
{
$this->setContent(json_encode($content));
}
Important notices
Before you add a new report, we ask you kindly to acknowledge the following:
Describe the bug
New fresh install of OPNSense 24.7 . Using the API, getting a "authentication error" the "setJsonContent" is not found in MVC. looking at the code in:
/usr/local/opnsense/mvc/app/controllers/OPNsense/Base/ApiControllerBase.php line: 271, 282 and 304
There is a $this->response->setJsonContent, but in: /usr/local/opnsense/mvc/app/library/OPNsense/Mvc/Response.php
There is no "setJsonContent".
I think it's a missing function.
To Reproduce
Steps to reproduce the behavior: Just do any call to the API with a wrong key authentication.
Expected behavior
logs without error about "missing setJsonContent function"
OPNsense 24.7.1 (amd64). Intel(R) Celeron(R) N5105 @ 2.00GHz Network Intel(R) Ethernet Controller I225-V