Changeset 12428 in project


Ignore:
Timestamp:
11/09/08 21:01:32 (11 years ago)
Author:
sjamaan
Message:

Always send status messages with text/html content-type

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/4/spiffy/trunk/spiffy.scm

    r12150 r12428  
    9494            (handler (alist-ref ext (file-extension-handlers)
    9595                                string-ci=? send-static-file)))
    96        ;; Should we modify the content-type here or later on?
    97        (with-headers `((content-type ,(extension->mime-type ext)))
    98          (lambda () (handler path)))))))
     96       (handler path)))))
    9997(define handle-not-found
    10098  (make-parameter
     
    144142;; A simple utility procedure to render a status code with message
    145143(define (send-status code reason #!optional text)
    146   (parameterize ((current-response (update-response (current-response)
    147                                                     code: code
    148                                                     reason: reason)))
     144  (parameterize ((current-response
     145                  (update-response (current-response)
     146                                   code: code
     147                                   reason: reason
     148                                   headers:
     149                                   (headers
     150                                    `((content-type text/html))
     151                                    (response-headers (current-response))))))
    149152    (write-response (current-response))
    150153    (with-output-to-port (response-port (current-response))
     
    167170(define (send-static-file filename)
    168171  (let ((path (make-pathname (root-path) filename)))
    169     (with-headers `((content-length ,(file-size path)))
     172    (with-headers `((content-length ,(file-size path))
     173                    (content-type ,(extension->mime-type (pathname-extension filename))))
    170174      (lambda ()
    171175        (write-response (current-response))
Note: See TracChangeset for help on using the changeset viewer.