web: redirect: Accept optional query argument.
authorRicardo Wurmus <rekado@elephly.net>
Sun, 5 Apr 2020 15:39:27 +0000 (17:39 +0200)
committerRicardo Wurmus <rekado@elephly.net>
Sun, 5 Apr 2020 16:28:44 +0000 (18:28 +0200)
mumi/web/render.scm

index 61ccde611651748f3dd7263baaa152c51ea99137..7f997313b76744bc7a8b9303768565f109fcfc90 100644 (file)
   (list (build-response #:code 201)
         ""))
 
-(define* (redirect path #:optional (headers '()))
+(define* (redirect path #:optional query (headers '()))
   (let ((uri (build-uri 'http
                         #:host (%config 'host)
                         #:port (%config 'port)
                         #:path (string-append
-                                "/" (encode-and-join-uri-path path)))))
+                                "/" (encode-and-join-uri-path path))
+                        #:query query)))
     (list (build-response
            #:code 301
            #:headers (append `((content-type . (text/html))