web-redirect/temporary! -> web-redirect!

This commit is contained in:
Tony Garnock-Jones 2016-11-23 15:39:11 +13:00
parent 3ce8bc380b
commit 0d34e3280e
1 changed files with 9 additions and 7 deletions

View File

@ -30,7 +30,7 @@
web-respond/bytes! web-respond/bytes!
web-respond/string! web-respond/string!
web-respond/xexpr! web-respond/xexpr!
web-redirect/temporary! web-redirect!
append-url-path append-url-path
@ -161,14 +161,16 @@
(bytes-append preamble (bytes-append preamble
(string->bytes/utf-8 (xexpr->string body-xexpr))))) (string->bytes/utf-8 (xexpr->string body-xexpr)))))
(define (web-redirect/temporary! id location (define (web-redirect! id location
#:content-type [content-type "text/html"] #:code [code 303]
#:body [body `(html (body (a ((href ,location)) #:message [message #"Redirect"]
"Moved to " ,location)))]) #:content-type [content-type "text/html"]
#:body [body `(html (body (a ((href ,location))
"Moved to " ,location)))])
(web-respond/xexpr! id (web-respond/xexpr! id
#:header (make-web-response-header #:header (make-web-response-header
#:code 303 #:code code
#:message #"Moved" #:message message
#:headers (list (cons 'location location) #:headers (list (cons 'location location)
(cons 'content-type content-type))) (cons 'content-type content-type)))
body)) body))