Set 404 status to not-found response

This commit is contained in:
Akira Tempaku 2025-04-01 01:15:02 +09:00
parent bc87e5de01
commit 3c83e74a84
Signed by: paku
GPG key ID: 5B4E8402BCC50607
2 changed files with 3 additions and 4 deletions

View file

@ -7,6 +7,8 @@
#:regex-replace
#:regex-replace-all)
(:import-from #:ningle)
(:import-from #:lack/response
#:response-status)
(:import-from #:trivial-system-loader
#:load-system)
(:export #:pathname->path
@ -60,6 +62,7 @@
(if (string= uri "/not-found")
(let ((handler (find-symbol "HANDLE-NOT-FOUND" pkg)))
(defmethod ningle:not-found ((app ningle:app))
(setf (response-status ningle:*response*) 404)
(funcall handler))))
(loop
:for method :in *http-request-methods*

View file

@ -1,11 +1,7 @@
(defpackage #:ningle-fbr-test/routes/not-found
(:use #:cl)
(:import-from #:lack/response)
(:import-from #:ningle)
(:export #:handle-not-found))
(in-package #:ningle-fbr-test/routes/not-found)
(defun handle-not-found ()
(setf (lack/response:response-status ningle:*response*)
404)
"Not Found")