When using an HTMX query, I create a 404 error from
PageNotFoundException. At the same time, instead of an HTML response, I get JSON.
Is this how it's planned or am I doing something wrong?
PHP Code:
public function show(int $id)
{
throw PageNotFoundException::forPageNotFound();
}
Request:
Code:
POST /notification/show/111 HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Accept-Language: ru,en;q=0.9
Connection: keep-alive
Content-Length: 0
Content-Type: application/x-www-form-urlencoded
Cookie: app_session=jeut72n5e0c3fmvud8n92jhgu2elgt3f
DNT: 1
HX-Current-URL: http://ci-demo/notifications
HX-Request: true
HX-Target: modals
HX-Trigger: notification-item-332
Host: ci-demo
Origin: http://ci-demo
Referer: http://ci-demo/notifications
User-Agent: Mozilla/5.0
Response:
Code:
HTTP/1.1 404 Not Found
Date: Mon, 08 Apr 2024 04:26:13 GMT
Server: Apache/2.4.56 (Win64) OpenSSL/1.1.1t PHP/8.2.11
X-Powered-By: PHP/8.2.11
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Content-Length: 1281
Keep-Alive: timeout=5, max=99
Connection: Keep-Alive
Content-Type: application/json; charset=UTF-8