cch1 / http.async.client

Async Http Client - Clojure
http://cch1.github.com/http.async.client
267 stars 40 forks source link

Bad exception when trying to extract a null body. #4

Closed sbtourist closed 13 years ago

sbtourist commented 13 years ago

When trying to extract a response body with the "string" function, it fails if the body is null as follows:

java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.CharSequence

Even if extracting a null body may be an illegal operation, the above exception doesn't make the problem clear for the user.

sbtourist commented 13 years ago

By looking at your latest sources, I honestly don't get why it's giving that exception: maybe it's something you fixed in the latest snapshot version?

neotyk commented 13 years ago

By response with null body you mean empty body, right?

sbtourist commented 13 years ago

I mean the server doesn't return anything.

neotyk commented 13 years ago

Anything? Status line? Headers?

neotyk commented 13 years ago

I've fixed situation where no message body was delivered, response is done, and you want to use h.a.c/string or even h.a.c/body. Hopefully it fixes your issue: neotyk@27a6c1183b9817dfb2ee9af29c577c194b70d34f

sbtourist commented 13 years ago

Great: so did you succeed to reproduce the bug in your test? Out of curiosity, what caused that odd exception?

neotyk commented 13 years ago

I didn't manage to reproduce it :( Though I found another issue, which was following: If response was finished, and no body was delivered both string and body would wait infinitely for delivery of body. And that is what I have solved.

sbtourist commented 13 years ago

No worries: I'm adding sonatype repositories to leiningen, so that I can make the master working and try to reproduce it. Stay tuned.

neotyk commented 13 years ago

Pull from master, repository is already there.

neotyk commented 13 years ago

Is it still a bug for you, I can't reproduce it.

sbtourist commented 13 years ago

Can't reproduce this anymore: will eventually reopen if able to reproduce.