From ac1402819f222793d5148c4882fb4bfdab42d97f Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Fri, 29 Sep 2023 12:14:02 +0200 Subject: requests: configurable port and http vs https --- neocities/requests.scm | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'neocities/requests.scm') diff --git a/neocities/requests.scm b/neocities/requests.scm index 094b7bf..b6a74ff 100644 --- a/neocities/requests.scm +++ b/neocities/requests.scm @@ -43,7 +43,9 @@ encode-multipart-body)) (define* (neocities-url endpoint #:key (querystring '()) - (hostname #f)) + (hostname #f) + (insecure #f) + (port #f)) (define (encode-querystring querystring) (string-join (map (lambda (x) @@ -59,17 +61,12 @@ querystring) "&")) - ;; This is for testing locally :) - #;(build-uri 'http #:host "localhost" - #:port 1234 - #:path (string-append "/api/" endpoint) - #:query (encode-querystring querystring)) - (build-uri 'https + (build-uri (if insecure 'http 'https) #:host (or hostname "neocities.org") + #:port port #:path (string-append "/api/" endpoint) #:query (encode-querystring querystring))) - (define (encode-multipart-body files) "files is an alist with the filename and destination" -- cgit v1.2.3