Skip to content

Sets the created Tempfile to binary mode during RestClient::Request#fetch_body#110

Merged
ab merged 1 commit intorest-client:masterfrom
soomo:master
Mar 12, 2014
Merged

Sets the created Tempfile to binary mode during RestClient::Request#fetch_body#110
ab merged 1 commit intorest-client:masterfrom
soomo:master

Conversation

@dadiv
Copy link
Contributor

@dadiv dadiv commented Jan 27, 2012

I was using a REST API to retrieve a large binary file, so was interested in using raw_response mode.

I had a character encoding exception which made it clear that attempts at translation were going on, so I set the Tempfile to binary which solved my issue.

This may not be a typical use case (perhaps people are retrieving large text-based documents that should be character-translated) but I figured I'd offer this pull request in case this seems useful.

@mattmanning
Copy link
Member

I'm taking over releases for rest-client, and it would be nice to get this change into the next release. Would you be willing to write a test for this as well?

If you'd like you can also submit pull requests to mattmanning/rest-client, but we'll be moving the main repo under an organization soon.

Thanks.

@dmeiz
Copy link

dmeiz commented Jan 30, 2013

Howdy! Is the test the only thing preventing this from getting merged? If so, I'll see if I can push something shortly.

Also, I couldn't find the mattmanning/rest-client repo.

Thanks,
Dan

@L2G
Copy link
Member

L2G commented Jan 30, 2013

The fork that @mattmanning is maintaining is under the organization name @rest-client.

@dmeiz
Copy link

dmeiz commented Jan 31, 2013

Great, thanks! -Dan

@gitfool
Copy link

gitfool commented Dec 1, 2013

I'm hitting this serious flaw too, trying to download a binary file from AWS S3 via Chef s3_file resource, which uses the raw_response option ( https://github.com/adamsb6/s3_file/blob/master/libraries/s3_file.rb#L43 ). Surely binary mode should be the default?

Looking at https://github.com/rest-client/rest-client/blob/master/lib/restclient/request.rb#L213 this still hasn't been merged.

@packagethief
Copy link
Contributor

Added a test for @dadiv's work in #267.

ab added a commit that referenced this pull request Mar 12, 2014
Sets the created Tempfile to binary mode during RestClient::Request#fetch_body
@ab ab merged commit ba3b702 into rest-client:master Mar 12, 2014
@ab
Copy link
Member

ab commented Mar 12, 2014

Thanks all!

@ab ab added this to the 1.7.0 milestone Apr 26, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants