Add a helper function to render text
This commit is contained in:
parent
a92d4d0cf2
commit
16879a8182
1 changed files with 11 additions and 0 deletions
|
|
@ -36,6 +36,7 @@
|
|||
render-static-asset
|
||||
render-html
|
||||
render-json
|
||||
render-text
|
||||
not-found
|
||||
unprocessable-entity
|
||||
created
|
||||
|
|
@ -156,6 +157,16 @@
|
|||
(lambda (port)
|
||||
(scm->json json port))))
|
||||
|
||||
(define* (render-text text #:key (extra-headers '())
|
||||
(code 200))
|
||||
(list (build-response
|
||||
#:code code
|
||||
#:headers (append extra-headers
|
||||
'((content-type . (text/plain))
|
||||
(vary . (accept)))))
|
||||
(lambda (port)
|
||||
(display text port))))
|
||||
|
||||
(define (not-found uri)
|
||||
(list (build-response #:code 404)
|
||||
(string-append "Resource not found: " (uri->string uri))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue