Permalink
Browse files

allow responses bodies to be seqs

  • Loading branch information...
1 parent eae70f9 commit 30598be7bd38eefe96bf1d84582313706fb9c568 @cgrand cgrand committed Jan 20, 2009
Showing with 6 additions and 0 deletions.
  1. +2 −0 SPEC
  2. +4 −0 src/ring/jetty.clj
View
2 SPEC
@@ -109,6 +109,8 @@ A Ring response is a Clojure map containing at least the following keys and corr
the response's status code. The respond body is handled according to its type:
String:
Contents are sent to the client as-is.
+ ISeq:
+ Each element of the seq is sent to the client as a string.
File:
Contents at the specified location are sent to the client. The server may
use an optimized method to send the file if such a method is available.
View
@@ -47,6 +47,10 @@
(string? body)
(with-open [writer (.getWriter response)]
(.println writer body))
+ (seq? body)
+ (with-open [writer (.getWriter response)]
+ (doseq [chunk body]
+ (.print writer (str chunk))))
(instance? InputStream body)
(let [#^InputStream in body]
(with-open [out (.getOutputStream response)]

0 comments on commit 30598be

Please sign in to comment.