From: Michael Guterl Date: 2008-09-30T22:27:30+09:00 Subject: Re: rest-client get header only Hi Keith, On Tue, Sep 30, 2008 at 7:45 AM, Keith Langdon wrote: > Hi, using the great rest-client from Adam Wiggins, but I can't seam to > be able work out how to get just the HEAD of a URL. > i.e. in curl I would : curl -I URL > > I'm getting the data just fine with: > return_data = RestClient.get "URL" > > Is there a way of doing this, or should I go about it a different way? > Looking at the documentation at http://rest-client.heroku.com/rdoc/ it does not appear that there is a RestClient#head method. However, looking at the internals you may be able to do: uri = 'http://google.com' headers = {} RestClient::Request.execute(:method => :head, :url => url, :headers => headers) > I'm using it to get the filename sent back from a send_data command in a > rails app. > > Still very new to all this ruby/rails jive, but liking it so far! > Welcome aboard! Michael Guterl