Memoize

BasicWerk   EC Support   Technique   Facebook  

20140902231825_ruby_net_http

ruby_net_http

 

 

Ruby の Net::HTTP を使って HTTP Status を確認。

 
[1] pry(main)> require 'net/http'
=> true
 
[2] pry(main)> uri = URI("http://basicwerk.com/memoize/")
=> #<URI::HTTP:0x007fff13027b40 URL:http://basicwerk.com/memoize/>
 
[3] pry(main)> res = Net::HTTP.get_response(uri)
=> #<Net::HTTPOK 200 OK readbody=true>
 
[4] pry(main)> res.code
=> "200"
 
[5] pry(main)> res.message
=> "OK"
 

 

http://ruby-doc.org/stdlib-2.1.1/libdoc/net/http/rdoc/Net/HTTP.html

 


© Shin Nakamura/BasicWerk 2014