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

Remove AbstractResponse#to_i, which is too unexpected, considering: #103

Merged
merged 1 commit into from Mar 14, 2015

Conversation

Projects
None yet
5 participants
@godfat
Copy link
Contributor

godfat commented Nov 29, 2011

require 'webmock'
require 'rest-client'
WebMock::API.stub_request(:get, 'http://host/').to_return(:body => '123')

RestClient.get('http://host/')        # "123"
RestClient.get('http://host/').to_s   # "123"
RestClient.get('http://host/').to_str # "123"
RestClient.get('http://host/').class  # String

RestClient.get('http://host/').to_i         # 200
RestClient.get('http://host/').to_s.to_i    # 200
RestClient.get('http://host/').to_str.to_i  # 200
String(RestClient.get('http://host/')).to_i # 200

RestClient.get('http://host/').dup.to_i         # 123
String.new(RestClient.get('http://host/')).to_i # 123
"#{RestClient.get('http://host/')}".to_i        # 123

RestClient.get('http://host/').clone.to_i       # 200
Remove AbstractResponse#to_i, which is too unexpected, considering:
require 'webmock'
require 'rest-client'
WebMock::API.stub_request(:get, 'http://host/').to_return(:body => '123')

RestClient.get('http://host/')        # "123"
RestClient.get('http://host/').to_s   # "123"
RestClient.get('http://host/').to_str # "123"
RestClient.get('http://host/').class  # String

RestClient.get('http://host/').to_i         # 200
RestClient.get('http://host/').to_s.to_i    # 200
RestClient.get('http://host/').to_str.to_i  # 200
String(RestClient.get('http://host/')).to_i # 200

RestClient.get('http://host/').dup.to_i         # 123
String.new(RestClient.get('http://host/')).to_i # 123
"#{RestClient.get('http://host/')}".to_i        # 123

RestClient.get('http://host/').clone.to_i       # 200
@ayamomiji

This comment has been minimized.

Copy link

ayamomiji commented Apr 16, 2012

+1 for this, i just wasted too much time on this...

@L2G

This comment has been minimized.

Copy link
Member

L2G commented Mar 9, 2013

(For reference only: This is one of many patches included in #106.)

@dinatih

This comment has been minimized.

Copy link

dinatih commented Feb 25, 2014

+1 please

@ab

This comment has been minimized.

Copy link
Member

ab commented Mar 28, 2014

Ugh, this behavior is painful. I'm wary of removing it outright though, since it's been around for so long, and people might be relying on it.

@ab ab added the bug label Mar 28, 2014

@ab ab merged commit b5d5a85 into rest-client:master Mar 14, 2015

@ab ab added this to the 2.0.0 milestone Mar 14, 2015

@ab ab self-assigned this Mar 14, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment