fix: include http error code on json api format

This commit is contained in:
Luis Pereira 2025-12-26 11:08:11 +00:00 committed by Brian O'Reilly
parent 6499c0a9ab
commit b32e0bdbb0
1 changed files with 4 additions and 1 deletions

View File

@ -39,7 +39,10 @@
(define-api-format json (data)
"JSON API format for Radiance"
(setf (header "Content-Type") "application/json")
(cl-json:encode-json-to-string data))
(let ((status (gethash "status" data)))
(when (and status (boundp '*response*))
(setf (return-code *response*) status))
(cl-json:encode-json-to-string data)))
;; Set JSON as the default API format
(setf *default-api-format* "json")