aboutsummaryrefslogtreecommitdiff
path: root/module/web/http/make-routes.scm
diff options
context:
space:
mode:
Diffstat (limited to 'module/web/http/make-routes.scm')
-rw-r--r--module/web/http/make-routes.scm17
1 files changed, 10 insertions, 7 deletions
diff --git a/module/web/http/make-routes.scm b/module/web/http/make-routes.scm
index feba3f19..a36efaef 100644
--- a/module/web/http/make-routes.scm
+++ b/module/web/http/make-routes.scm
@@ -145,6 +145,8 @@
;; TODO propper logging
(display (format #f "[~a] ~a ~a:~a~a?~a~%"
+ ;; TODO does this even work? Maybe it works due to datetime
+ ;; being included at all expansion points.
(datetime->string (current-datetime))
r:method r:host r:port r:path (or r:query ""))
(current-error-port))
@@ -164,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))