blob: f6110952c6c95f7c5eae1f8c3c01c132d80e57df (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
(define-module (server util)
:use-module (util)
:use-module (srfi srfi-1))
(define-public (parse-query query)
(when query
(fold (lambda (str list)
;; only split on the first equal.
;; Does HTTP allow multiple equal signs in a data field?
(define idx (string-index str #\=))
(define key (substring str 0 idx))
(define val (substring str (1+ idx)))
(cons* (-> key string->symbol symbol->keyword) val list))
'() (string-split query #\&))))
|