-1

Is there a ruby library, with which I can request the web server to return only the header response and no content? This will help me speed up a script in which all I care is the response code.

I am now using this

Net::HTTP.get_response(URI(url))

but the server generates all the assert files and so on, which I do not want.

sawa
  • 165,429
  • 45
  • 277
  • 381
anyavacy
  • 1,618
  • 5
  • 21
  • 43
  • Your question as is (asking us to recommend or find a book, tool, software library, tutorial or other off-site resource), is off-topic. You may be able to make it on-topic by asking "how you can do it". – sawa Jul 20 '16 at 12:28
  • the question is clear enought to be understood and their is an example that specifies what I am using. thnks for sharing your idea though – anyavacy Jul 20 '16 at 14:16

2 Answers2

0

You might use rest-client gem and in particular head method. http://www.rubydoc.info/github/rest-client/rest-client/RestClient#head-class_method

Ursus
  • 29,643
  • 3
  • 33
  • 50
0

This can be done using 'Net::HTTP::Head' in the net-http library. other libraries also support it, just remember to look for the HEAD method instead of the Get method

anyavacy
  • 1,618
  • 5
  • 21
  • 43