diff --git a/src/core/handler/hunchentoot.lisp b/src/core/handler/hunchentoot.lisp index 20d7283d..25688ebb 100644 --- a/src/core/handler/hunchentoot.lisp +++ b/src/core/handler/hunchentoot.lisp @@ -58,21 +58,21 @@ If no acceptor given, try to stop `*acceptor*' by default." "Convert Response from Clack application into a string before pass to Hunchentoot." (destructuring-bind (status headers body) res + (setf (return-code*) status) + (loop for (k v) on headers by #'cddr + with hash = (make-hash-table :test #'eq) + if (gethash k hash) + do (setf (gethash k hash) + (format nil "~:[~;~:*~A, ~]~A" (gethash k hash) v)) + else do (setf (gethash k hash) v) + finally + (loop for k being the hash-keys in hash + using (hash-value v) + do (setf (header-out k) v))) (etypecase body (pathname (hunchentoot:handle-static-file body (getf headers :content-type))) (list - (setf (return-code*) status) - (loop for (k v) on headers by #'cddr - with hash = (make-hash-table :test #'eq) - if (gethash k hash) - do (setf (gethash k hash) - (format nil "~:[~;~:*~A, ~]~A" (gethash k hash) v)) - else do (setf (gethash k hash) v) - finally - (loop for k being the hash-keys in hash - using (hash-value v) - do (setf (header-out k) v))) (with-output-to-string (s) (format s "~{~A~^~%~}" body))))))