dakrone / clj-http

An idiomatic clojure http client wrapping the apache client. Officially supported version.
http://clojars.org/clj-http
MIT License
1.77k stars 408 forks source link

Fix #609: Fix reading Transit response stream if data isn't available… #611

Closed Deraen closed 2 years ago

Deraen commented 2 years ago

… right-away

InputStream .available only checks if data is available to read right now. It is possible that data becomes available leter. Read method (used by Transit internally) will block untill data is available or the stream is closed.

It is best to let Transit read the stream. Empty streams throws an exception with Transit, but we can catch that specific case and return nil like previously.

Two test cases test the existing functionality, and third new test case checks that Transit data is read correctly when the data becomes available a bit later.

dakrone commented 2 years ago

Merged, thanks again!