summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2020-04-05 16:56:55 +0200
committerRicardo Wurmus <rekado@elephly.net>2020-04-05 16:58:08 +0200
commitf72a8d5bf64f91766a06122ab8e4ba0517b8dbc6 (patch)
tree7a0d4b38a6d438befd46f217c7a02e88bf60c48e
parentf93d1c34c095b54545767fec2743ea0e4155b5ed (diff)
web: redirect: Accept extra headers.
-rw-r--r--mumi/web/render.scm9
1 files changed, 5 insertions, 4 deletions
diff --git a/mumi/web/render.scm b/mumi/web/render.scm
index 02cd648..146a001 100644
--- a/mumi/web/render.scm
+++ b/mumi/web/render.scm
@@ -1,5 +1,5 @@
;;; mumi -- Mediocre, uh, mail interface
-;;; Copyright © 2016, 2017 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2016, 2017, 2020 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2014 David Thompson <davet@gnu.org>
;;;
;;; This program is free software: you can redistribute it and/or
@@ -113,7 +113,7 @@
(list (build-response #:code 201)
""))
-(define (redirect path)
+(define* (redirect path #:optional (headers '()))
(let ((uri (build-uri 'http
#:host (%config 'host)
#:port (%config 'port)
@@ -121,6 +121,7 @@
"/" (encode-and-join-uri-path path)))))
(list (build-response
#:code 301
- #:headers `((content-type . (text/html))
- (location . ,uri)))
+ #:headers (append `((content-type . (text/html))
+ (location . ,uri))
+ headers))
(format #f "Redirect to ~a" (uri->string uri)))))