Closed zahardzhan closed 14 years ago
Thanks for you interest in ahc-clj.
Will look into this issue this evening.
Please check http://github.com/neotyk/ahc-clj/blob/837773f72dc7f68f1f32f7d58eecfd0ba8403205/test/async/http/client/test.clj#L288 This issue is not a bug in a client, you tried to create chars out of bytes, that was core of the issue.
Note that: String. (byte-array (:body @resp)) "UTF-8") does the job properly.
Could you also provide a sample of how you would like to consume InputStream?
will be moving implementation to use ByteArrayOutputStream and providing helper fns to read from it.
Here the only place where i use input stream in my programs: http://github.com/zahardzhan/leica/blob/simplify/src/simplify.clj#L260
The best way to use it with your client i see: (with-open [input (:stream @(GET link))] ...)
Please look into issue-1 branch at proposed solution.
Basically if you wan't string: (string (GET url))
http://github.com/neotyk/ahc-clj/blob/issue-1/test/async/http/client/test.clj#L282
Thank you. Upload new version to clojars please.
You are welcome and thank you very much for your feedback. New version will get released as soon as we release Async Http Client Java, as current 0.2.0-SNAPSHOT of ahc-clj depends on fixes that have to be released in Async Http Client Java.
You use an a vector of bytes to collect response body, but i found it too bad design. I have exception when i try to get body of page in Russian lang, i think it is because of troubles with Unicode in your client. Can you use stream of bytes instead vector of bytes, like in clojure.contrib.http.client?
(apply str (map char (:body @(HTTP/GET "http://gettingreal.37signals.com/GR_rus.php"))))