Permalink
Browse files

Added 'header' function to ring.util.response

  • Loading branch information...
1 parent 849c1e6 commit c368a709247905234347fd4e578eea32e54306ae @weavejester weavejester committed Jun 9, 2010
Showing with 6 additions and 1 deletion.
  1. +6 −1 ring-core/src/ring/util/response.clj
View
7 ring-core/src/ring/util/response.clj
@@ -59,8 +59,13 @@
[resp status]
(assoc resp :status status))
+(defn header
+ "Returns an updated Ring response with the specified header added."
+ [resp name value]
+ (assoc-in resp [:headers name] (str value)))
+
(defn content-type
"Returns an updated Ring response with the a Content-Type header corresponding
to the given content-type."
[resp content-type]
- (assoc-in resp [:headers "Content-Type"] content-type))
+ (header resp "Content-Type" content-type))

0 comments on commit c368a70

Please sign in to comment.