Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make GetObjectObject#body always be IO #65

Merged
merged 2 commits into from
Jan 13, 2020

Conversation

carlhoerberg
Copy link
Contributor

Currently code using this has to check which type it is.

Currently code using this has to check which type it is.
@taylorfinnell
Copy link
Owner

I have not looked at it much, but this throws errors when you run the object_put_get.cr example in examples/

@carlhoerberg
Copy link
Contributor Author

Ok, yes, this patch isn't backward compatible. puts resp.body will raise as there's no IO#to_s. One way to still be backward compatible is to add a GetObjectOutput#body_io instead.

@carlhoerberg
Copy link
Contributor Author

Otherwise, to fix the example you just change the last line to puts resp.body.gets_to_end, or the very more efficient IO.copy resp.body, STDOUT

@carlhoerberg
Copy link
Contributor Author

Created a new class for streamed objects, which only got the body_io, normal synchronus get_object now only got body and it's always a string.

@taylorfinnell
Copy link
Owner

Thank you!

@taylorfinnell taylorfinnell merged commit b07df08 into taylorfinnell:master Jan 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants