fukamachi / lack

Lack, the core of Clack
MIT License
148 stars 33 forks source link

Suggest fix to finalize-response function in src/response.lisp #43

Closed madosuki closed 4 years ago

madosuki commented 4 years ago
(defun finalize-response (res)
  (finalize-cookies res)
  (with-slots (status headers body no-body) res
    (list* status headers
           (cond
             ((and no-body (not body)) nil)
             ((or (consp body) (pathnamep body))
              (list body))
             (t (list (list body)))))))

The above code is currently code. When pass '(vector (unsigned-byte 8)) to that function cause crash in handle-response function in "clack/src/handler/hunchentoot.lisp".

I suggest an example fix code to below.

(defun finalize-response (res)
  (finalize-cookies res)
  (with-slots (status headers body no-body) res
    (list* status headers
           (cond
             ((and no-body (not body)) nil)
             ((or (consp body) (pathnamep body) (and (not (stringp body)) (vectorp body)))
              (list body))
             (t (list (list body)))))))
madosuki commented 4 years ago

this issue closed because merged.