title: How to get only the response code from a HTTP Request in Ruby
body: <p>I have a list of urls, I need to check which of the following urls are valid.</p>
  
  <p>The code I used is </p>
  
  <pre><code>require 'net/http'
  
  url = 'http://mysite.com'
  res = Net::HTTP.get_response(URI.parse(url.to_s))
  puts res.code
  </code></pre>
  
  <p>Here I can check the response code 200 for a valid url. My concern is the 'res' object returned contains  code, body, etc. So my response (res object) becomes heavy. Is there any way so that I can get only the response code. I don't need any other info. Please help</p>