Permalink
Browse files
allow responses bodies to be seqs
- Loading branch information...
Showing
with
6 additions
and
0 deletions.
-
+2
−0
SPEC
-
+4
−0
src/ring/jetty.clj
|
|
@@ -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.
|
|
|
|
|
|
@@ -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