File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change 22 (:use [clojure.contrib.java-utils :only [as-str]]
33 [clojure.contrib.duck-streams :only [read-lines writer]]
44 [clojure.contrib.str-utils :only [str-join]])
5- (:import (java.net URL HttpURLConnection URLEncoder)
5+ (:import (java.net URL URLEncoder)
66 (java.io StringReader)))
77
88(def default-headers {" User-Agent" (str " Clojure/" (clojure-version )
@@ -82,7 +82,7 @@ by a server."
8282 (first header)
8383 (second header)))
8484
85- (when cookies
85+ (when ( and cookies ( not ( empty? cookies)))
8686 (.setRequestProperty connection
8787 " Cookie"
8888 (create-cookie-string cookies)))
@@ -93,10 +93,9 @@ by a server."
9393 " Content-Type"
9494 " application/x-www-form-urlencoded" )
9595 (.connect connection)
96- (.write (writer (.getOutputStream connection))
97- (if (isa? body String)
98- body
99- (encode-body-map body))))
96+ (with-open [out (writer (.getOutputStream connection))]
97+ (.write out " { hello: \" world\" }" )
98+ (.flush out)))
10099 (.connect connection))
101100
102101 (let [headers (parse-headers connection)]
You can’t perform that action at this time.
0 commit comments