Impl. response using PSR-7 interface#1706
Conversation
mvorisek
left a comment
There was a problem hiding this comment.
request must be handled as PSR request as well
laminas dep should be not needed if this translates to a few echo/header/http_response_code lines
I replace with code, but because of the small difference in performance, I always prefer the ready-made solutions, which are already tested in almost every situation, even those we don't know at the moment. |
|
Line 1119 in beb149f Are you sure that this cannot be changed to an Exception or other ways to not force exit the process? My fear is that if you use Atk4 in a routing/handler contest, that exit in place of an Error will stop the flow without an output, without running post route middleware or logging of the error, without considering that to avoid that line you must override via copy/paste the whole method just to remove it. |
I see the PR #1671 which remove/assert that there is no global sticky. But before this i need to understand why demos, except for SSE, works perfect, but not in tests. |
replacing literaly no more than several lines and doubling the non-dev dependencies, is IMHO really not helpful |
can be put into a protected method that can be overriden with a custom exit handler, but as described, it is too late to have a full control of the output as partly sent already |
63706b1 to
45d7382
Compare
45d7382 to
40d7df5
Compare
40d7df5 to
60e12f0
Compare
67fa15f to
e65e2c7
Compare
57a2492 to
d7faa9c
Compare
src/App.php
Outdated
| public function issetRequestGetParam(string $key): bool | ||
| { | ||
| return isset($this->request->getQueryParams()[$key]); | ||
| } | ||
|
|
||
| /** | ||
| * Return $_GET param by key or null if not exists. | ||
| * | ||
| * @return mixed | ||
| */ | ||
| public function getRequestGetParam(string $key) | ||
| { | ||
| return $this->request->getQueryParams()[$key] ?? null; | ||
| } | ||
|
|
||
| /** | ||
| * Return whole $_POST data. | ||
| */ | ||
| public function getRequestPostParams(): array | ||
| { | ||
| return $this->request->getParsedBody() ?? []; | ||
| } | ||
|
|
||
| /** | ||
| * Return $_POST param by key or null if not exists. | ||
| * | ||
| * @return mixed | ||
| */ | ||
| public function getRequestPostParam(string $key) | ||
| { | ||
| return $this->request->getParsedBody()[$key] ?? null; | ||
| } | ||
|
|
|
Thank you @abbadon1334 ❤️ |
App::outputXxx/terminateXxxmethods not longer accepts$headersas 2nd param, call$app->setResponseHeader()before it if needed