excon/excon — pull request #411 by franciscodelgadodev (2014-07-31 20:33:24+00:00)
Title: Content length detection - Edge case ruby2.0.0p195

We're using ruby 2.0.0p195 and Neography gem that includes excon as a dependency. When we
execute any Neography query in a Before block(test environment) the
first request is done and everything is fine until the second request is
executed.

When the second request is executed, the method Excon::Connection#detect_content_length brakes all
our test suite. We're using instances of StringIO and when it calls to
"size" inside the method mentioned above it returns nil. The weird thing
is that the StringIO instance is created with the same string in both two cases(first and second request)
but it only fails for the fisrt request(TOO WEIRD :P).

We debugged Neography and then Excon and it took us until this point
and until that method. Our solution was to extract the content length from the :length method before using the :size one.
That fixed our problem and it looks good now.

We hope to help more people who is having the same issue than us.