chickadee » awful » awful-response-headers

awful-response-headers #!optional alistparameter

An alist to specify the headers to be used in the response. If the content-length header is not provided, awful will calculate it automatically.

Here's an example:

(cond-expand
  (chicken-4
    (use awful))
  (chicken-5
    (import awful)))

(enable-sxml #t)

(define (define-json path body)
  (define-page path
    (lambda ()
      (awful-response-headers '((content-type "application/json")))
      (body))
    no-template: #t))


(define-json (main-page-path)
  (lambda ()
    '(literal "{\"a\": 1}")))