Sets the created Tempfile to binary mode during RestClient::Request#fetch_body#110
Sets the created Tempfile to binary mode during RestClient::Request#fetch_body#110ab merged 1 commit intorest-client:masterfrom soomo:master
Conversation
… character encoding translation
|
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. |
|
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, |
|
The fork that @mattmanning is maintaining is under the organization name @rest-client. |
|
Great, thanks! -Dan |
|
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. |
Sets the created Tempfile to binary mode during RestClient::Request#fetch_body
|
Thanks all! |
I was using a REST API to retrieve a large binary file, so was interested in using
raw_responsemode.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.