From 0ca5748c0ff082500fa27cd8032f14ccbc4e6df4 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sat, 18 May 2019 20:25:05 +0100 Subject: Enable passing extra headers for JSON responses Mostly to enable passing the cache-control header. --- guix-data-service/web/render.scm | 5 +++-- 1 file 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)))) -- cgit v1.2.3