Consider introducing shortcut to check Net::HTTP response type
Currently you need to either use
HTTPResponse#code to find out the type of a response.
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: (uri.scheme == 'https'), cert: OpenSSL::X509::Certificate.new(client_cert), key: OpenSSL::PKey::RSA.new(client_key)) do |http| http.request(request) end if response.code || response.kind_of?(Net::HTTPSuccess) ... end
How about using data from either
Net::HTTPResponse::CODE_TO_OBJ to simply it to:
if response.ok? ... end
#7 [ruby-core:86193] Updated by shevegen (Robert A. Heiler) 4 months ago
I'd say it is ok to add .ok?
What is missing is a description as to what the method
does. In the link that you provided it is unclear to which part
exactly you refer the "
#ok?" method. It may be easier for whoever
adds the code to
Net::HTTP to have a description ready what the
method does exactly, such as when to return which
provided that the ruby core team/matz is fine with this method).