halorgium / rack-client

A client wrapper around a rack app or live-http
http://halorgium.github.com/rack-client
MIT License
99 stars 28 forks source link

Close out body after reading if available #21

Closed jasonrclark closed 6 years ago

jasonrclark commented 9 years ago

In more recent versions of Rack, if the body provides a #close method, that is expected to be called after iteration over the contents of the body. (See https://github.com/rack/rack/blob/ed9050876dfa2418613db05fb52015dc97cb78fb/SPEC#L250-L252 for the relevant section of the spec).

We ran into this when updating some tests that use the ey_services_fake gem which internally relies on Rack::Client. This was ending up making a call that went through the Rack::Lock middleware, and then would hang on any second request because the Rack::BodyProxy that was holding a lock never properly closed out once Rack::Client::Response replaced the body.

ryansouza commented 9 years ago

This is biting us internally as well with thread deadlocks