Set body-parameters only when the parsed data is an alist.

This commit is contained in:
Eitaro Fukamachi 2018-10-26 22:41:54 +09:00
parent 4bd5dca97a
commit 2a9fc540cf

View file

@ -102,8 +102,10 @@
;; POST parameters
(when (and (null body-parameters)
(request-has-body-p req))
(setf body-parameters
(http-body:parse content-type content-length raw-body))
(let ((parsed (http-body:parse content-type content-length raw-body)))
(when (and (consp parsed)
(every #'consp parsed))
(setf body-parameters parsed)))
(file-position raw-body 0)
(setf (getf env :raw-body) raw-body)
(rplacd (last env) (list :body-parameters body-parameters)))))