CrossClj

0.9.9 docs

SourceDocs



RECENT
    VARS
    ->map
    content-type
    edn
    empty
    json
    jsonp
    redirect
    set-headers
    status
    xml

    « Index of all namespaces of this project

    Simple response helpers to change the content type, redirect, or return a canned response
    
    Private
    (->map c)
    (content-type ctype content)
    Wraps the response with the given content type and sets the body to the content.
    
    (edn data)
    Wraps the response in the application/edn content-type
    and calls pr-str on the Clojure data stuctures passed in.
    (empty)
    Return a successful, but completely empty response
    
    (json content)
    Wraps the response in the json content type and generates JSON from the content
    
    (jsonp func-name content)
    Generates JSON for the given content and creates a javascript response for calling
    func-name with it.
    (redirect url)(redirect url type)(redirect url type request)
    A header redirect to a different URI. If given one argument,
    returns a 302 Found redirect. If given two arguments, the
    second argument should be a keyword indicating which redirect
    status to use. Choices are:
    
    :permanent    -- A 301 permanent redirect.
    :found        -- A 302 found redirect (default).
    :see-other    -- A 303 see other redirect.
    :not-modified -- A 304 not modified redirect.
    :proxy        -- A 305 proxy redirect.
    :temporary    -- A 307 temporary redirect.
    
    To see what these redirects are for in detail, visit
    http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3
    
    finally, request can be passed in as the third argument, useful
    if request is bound to a var
    (set-headers headers content)
    Add a map of headers to the given response. Headers must have
    string keys:
    
    (set-headers {"x-csrf" csrf}
      (common/layout [:p "hey"]))
    (status code content)
    Wraps the content in the given status code
    
    (xml content)
    Wraps the response with the content type for xml and sets the body to the content.