8.16.0.1
response-ext
(require response-ext) | package: response-ext |
Extended HTTP response functions for Racket Web Server
procedure
(response/make content [ #:code code #:message message #:seconds seconds #:mime-type mime-type #:headers headers]) → response? content : string? code : number? = 200 message : bytes? = #"Okay" seconds : number? = (current-seconds) mime-type : (or/c bytes? #f) = TEXT/HTML-MIME-TYPE headers : (listof header?) = '()
returns response with string content
procedure
(response/not-found [ content #:headers headers]) → response? content : string? = "Page not found" headers : (listof header?) = '()
returns response with 404 code
procedure
(response/file file [mime]) → response?
file : path-string? mime : bytes? = TEXT/HTML-MIME-TYPE
returns response with file content
procedure
(response/json json) → response?
json : jsexpr?
returns response with JSON
procedure
(response/redirect url [ permanent #:headers headers]) → response? url : non-empty-string? permanent : boolean? = #f headers : (listof header?) = '()
returns response with redirect