Skip to content
Browse files

Merge pull request #41 from onycloud/master

add content-type header for (render seq)
  • Loading branch information...
2 parents 01271e3 + 8f18d51 commit 7b144686db1666d336f3350febfb4210d6fd5bac @weavejester committed Sep 21, 2011
Showing with 8 additions and 1 deletion.
  1. +2 −1 src/compojure/response.clj
  2. +6 −0 test/compojure/test/response.clj
View
3 src/compojure/response.clj
@@ -30,7 +30,8 @@
File
(render [file _] (response file))
ISeq
- (render [coll _] (response coll))
+ (render [coll _] (-> (response coll)
+ (content-type "text/html; charset=utf-8")))
InputStream
(render [stream _] (response stream))
URL
View
6 test/compojure/test/response.clj
@@ -18,6 +18,12 @@
(is (= (response/render "<h1>Foo</h1>" {})
expected-response)))
+ (testing "with string seq"
+ (let [response (response/render '("<h1>" "Foo" "</h1>") {})]
+ (is (seq? (:body response)))
+ (is (= (:headers response)
+ {"Content-Type" "text/html; charset=utf-8"}))))
+
(testing "with handler function"
(is (= (response/render (constantly expected-response) {})
expected-response)))

0 comments on commit 7b14468

Please sign in to comment.
Something went wrong with that request. Please try again.