("html" . (text/html))))
(define (render-static-asset path)
- (render-static-file (assoc-ref %config 'assets-dir) path))
+ (render-static-file (%config 'assets-dir) path))
(define (render-static-file root path)
;; PATH is a list of path components
(file-extension file-name))))
(call-with-input-file file-name get-bytevector-all))
(not-found (build-uri 'http
- #:host (assoc-ref %config 'host)
- #:port (assoc-ref %config 'port)
+ #:host (%config 'host)
+ #:port (%config 'port)
#:path (string-join path "/" 'prefix))))))
-(define (render-html sxml)
- (list '((content-type . (text/html)))
+(define* (render-html #:key sxml (extra-headers '()))
+ (list (append extra-headers
+ '((content-type . (text/html))))
(lambda (port)
(sxml->html sxml port))))
(define (redirect path)
(let ((uri (build-uri 'http
- #:host (assoc-ref %config 'host)
- #:port (assoc-ref %config 'port)
+ #:host (%config 'host)
+ #:port (%config 'port)
#:path (string-append
"/" (encode-and-join-uri-path path)))))
(list (build-response