aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2023-04-10 22:56:40 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2023-04-10 23:45:29 +0200
commit3ccfd15e9b7beedb0f8c5d163181b340bafd8048 (patch)
treecb82b35cb7cb73e0bce8bd105cbf16d048e1e57c
parentAvoid extra string allocation in (calp server routes). (diff)
downloadcalp-3ccfd15e9b7beedb0f8c5d163181b340bafd8048.tar.gz
calp-3ccfd15e9b7beedb0f8c5d163181b340bafd8048.tar.xz
Minor style change.
-rw-r--r--module/web/http/make-routes.scm15
1 files changed, 8 insertions, 7 deletions
diff --git a/module/web/http/make-routes.scm b/module/web/http/make-routes.scm
index f83b2f34..a36efaef 100644
--- a/module/web/http/make-routes.scm
+++ b/module/web/http/make-routes.scm
@@ -166,13 +166,14 @@
;; When content-type is application/x-www-form-urlencoded,
;; decode them, and add it to the argument list
- (let ((content-type (assoc-ref r:headers 'content-type)))
- (when content-type
- (let ((type args (car+cdr content-type)))
- (when (eq? type 'application/x-www-form-urlencoded)
- (let ((encoding (or (assoc-ref args 'encoding) "UTF-8")))
- (parse-query (bytevector->string body encoding)
- encoding)))))))))))
+ (cond ((assoc-ref r:headers 'content-type)
+ => (lambda (content-type)
+ (let ((type args (car+cdr content-type)))
+ (case type
+ ((application/x-www-form-urlencoded)
+ (let ((encoding (or (assoc-ref args 'encoding) "UTF-8")))
+ (parse-query (bytevector->string body encoding)
+ encoding)))))))))))))
(case-lambda ((headers body new-state) (values headers body new-state))
((headers body) (values headers body state))