aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-05-18 20:25:05 +0100
committerChristopher Baines <mail@cbaines.net>2019-05-18 20:25:05 +0100
commit0ca5748c0ff082500fa27cd8032f14ccbc4e6df4 (patch)
tree63a7d613b85bb926aa85a6cfc6308fa9af96a36b
parent03faff5da040f6d5626dff0cfdcfd20d9f35f7ef (diff)
downloaddata-service-0ca5748c0ff082500fa27cd8032f14ccbc4e6df4.tar
data-service-0ca5748c0ff082500fa27cd8032f14ccbc4e6df4.tar.gz
Enable passing extra headers for JSON responses
Mostly to enable passing the cache-control header.
-rw-r--r--guix-data-service/web/render.scm5
1 files changed, 3 insertions, 2 deletions
diff --git a/guix-data-service/web/render.scm b/guix-data-service/web/render.scm
index 94cbf55..248de3c 100644
--- a/guix-data-service/web/render.scm
+++ b/guix-data-service/web/render.scm
@@ -97,8 +97,9 @@
(lambda (port)
(sxml->html sxml port))))
-(define (render-json json)
- (list '((content-type . (application/json)))
+(define* (render-json json #:key (extra-headers '()))
+ (list (append extra-headers
+ '((content-type . (application/json))))
(lambda (port)
(scm->json json port))))