aboutsummaryrefslogtreecommitdiff
path: root/module/web/uri-query.scm
blob: 56f3aef9015196245e45fb91c93c2d6df834ee0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
(define-module (web uri-query)
  :use-module ((hnh util) :select (->quoted-string))
  :use-module ((web uri) :select (uri-encode))
  )

;; TODO why this format for values?
;; TODO why aren't we encoding the keys?
;; TODO why isn't this in the same module as `parse-query'?
;; TODO why isn't this on the same format as `parse-query'?

(define-public (encode-query-parameters parameters)
  (string-join
   (map (lambda (p)
          (format #f "~a=~a"
                  (car p)
                  (uri-encode (->quoted-string (cdr p)))))
        parameters)
   "&"))