Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add content-type header for (render seq)

  • Loading branch information...
commit 8f18d51975cc0f01de158ded90ad265fad9c51bb 1 parent 01271e3
@shenfeng shenfeng authored
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)))
Please sign in to comment.
Something went wrong with that request. Please try again.