This repository was archived by the owner on Nov 20, 2018. It is now read-only.

Description
when I retrieve a versioned object from s3, the PlainStringIO is at the end of the file. So the code I have to write is:
object = @s3.get_object(bucket:@s3_bucket, key: key, version_id: version)
# TODO find out why this isn't always rewound?
object.body.rewind if object.body.respond_to?(:rewind)
Yajl::Parser.parse(object.body)
If I don't rewind the bodies, #read returns an empty string and there's a parsing error.
Looking at response.rb in seahorse I see that body= doesn't rewind or otherwise sanity check IOs it receives:
def body=(io)
@body = case io
when nil then PlainStringIO.new('')
when String then PlainStringIO.new(io)
else io
end
end
However I can't follow where the response bodies are actually set, so unfortunately I can't see if all those paths are ensuring that the values they set are in a sane state. By default they wouldn't be:
s = StringIO.new # => #<StringIO:0x007fdd722680c0>
s.write("asdf") # => 4
s.read # => ""