diff options
-rw-r--r-- | HACKING | 2 | ||||
-rw-r--r-- | neocities/requests.scm | 6 | ||||
-rw-r--r-- | tests/requests.scm | 4 |
3 files changed, 7 insertions, 5 deletions
@@ -39,6 +39,8 @@ dependencies manually: - pkg-config - texinfo - guile-hall + - guile-json + - guile-gcrypt Once those dependencies are installed you can run: diff --git a/neocities/requests.scm b/neocities/requests.scm index d0270c2..20d328d 100644 --- a/neocities/requests.scm +++ b/neocities/requests.scm @@ -51,13 +51,13 @@ (map (lambda (x) (let ((key (car x)) (value (cdr x))) - (if (= 1 (length value)) - (string-append (uri-encode key) "=" (uri-encode (car value))) + (if (list? value) (string-join (map (lambda (y) (string-append (uri-encode key) "=" (uri-encode y))) value) - "&")))) + "&") + (string-append (uri-encode key) "=" (uri-encode value))))) querystring) "&")) diff --git a/tests/requests.scm b/tests/requests.scm index 15cee77..727a886 100644 --- a/tests/requests.scm +++ b/tests/requests.scm @@ -55,10 +55,10 @@ (test-group "Encodes array in querystring" (define url (neocities-url "info" #:hostname "neocities.org" #:port 80 - #:querystring '(("file" . ("COSA CON ESPACIOS" "otra cosa"))))) + #:querystring '(("file[]" . ("COSA CON ESPACIOS" "otra cosa"))))) (test-assert (string=? (uri-query url) - "file[]=COSA%20CON%20ESPACIOS&file[]=otra%20cosa"))) + "file%5B%5D=COSA%20CON%20ESPACIOS&file%5B%5D=otra%20cosa"))) (test-end "URL") |