aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorcolin <colin@cicadas.surf>2025-01-13 06:02:16 -0800
committercolin <colin@cicadas.surf>2025-01-13 06:02:16 -0800
commitd1a2f16138c2bee5706668e132077ee3b12a7877 (patch)
tree3759cf5311f80d8f8031324e57898fc1501b73c8 /src/client
parentdda37d6f9f40d573776ac4bb6abe12adb8f33c47 (diff)
tweaksHEADmain
Diffstat (limited to 'src/client')
-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)))))))))))