aboutsummaryrefslogtreecommitdiff
path: root/src/client/ps/generate.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/ps/generate.lisp')
-rw-r--r--src/client/ps/generate.lisp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/client/ps/generate.lisp b/src/client/ps/generate.lisp
index 63c7753..0b1b458 100644
--- a/src/client/ps/generate.lisp
+++ b/src/client/ps/generate.lisp
@@ -10,7 +10,7 @@
;; this function largely mirrors the implementation of construct-route-builder
-(defun generate (class &optional alt-name)
+(defun generate (class &key alt-name (content-type "application/json"))
(when (symbolp class) (setf class (find-class class)))
(let*
@@ -53,14 +53,21 @@
method ,(string method)
cache "no-cache"
,@(when (wknd:body-expected-p method)
- `(headers (ps:create "Content-Type" "application/json")))
+ `(headers (ps:create "Content-Type" ,content-type)))
redirect "follow"
,@(when body (list 'body body))))
(then
(lambda (resp)
(and resp
(= 200 (ps:@ resp status))
- (ps:chain resp (json)))))))))
+ ,(cond ((string= content-type "application/json")
+ `(ps:chain resp (json)))
+
+ ((string= content-type "text/" :end1 5)
+ `(ps:chain resp (text)))
+
+ (t
+ `(ps:chain resp (blob)))))))))))