Hello, I''m interested in grabbing the final uri of a given uri after any redirects without retrieving the response body of this final uri. For example, if uri1 redirects to uri2, which in turn redirects to uri3, I''d like to just grab the response header of uri3. I know that I can get the full response (header and body) by doing Mechanize.new.get(uri1).uri, but again, I''m looking to make just a header request. Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/mechanize-users/attachments/20120430/d749ed80/attachment.html>
Just use .head instead of .gethttps:// www.goldstar.com/shows/555643/checkout/new On Mon, Apr 30, 2012 at 8:21 AM, shig odani <sodani at gmail.com> wrote:> Hello, I''m interested in grabbing the final uri of a given uri after any > redirects without retrieving the response body of this final uri. For > example, if uri1 redirects to uri2, which in turn redirects to uri3, I''d > like to just grab the response header of uri3. > > I know that I can get the full response (header and body) by doing > Mechanize.new.get(uri1).uri, but again, I''m looking to make just a header > request. > > Thanks. > > _______________________________________________ > Mechanize-users mailing list > Mechanize-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mechanize-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/mechanize-users/attachments/20120430/0c71742c/attachment.html>
Sorry for the copy/paste. On Mon, Apr 30, 2012 at 8:32 AM, Matt White <mattw922 at gmail.com> wrote:> Just use .head instead of .gethttps:// > www.goldstar.com/shows/555643/checkout/new > > On Mon, Apr 30, 2012 at 8:21 AM, shig odani <sodani at gmail.com> wrote: > >> Hello, I''m interested in grabbing the final uri of a given uri after any >> redirects without retrieving the response body of this final uri. For >> example, if uri1 redirects to uri2, which in turn redirects to uri3, I''d >> like to just grab the response header of uri3. >> >> I know that I can get the full response (header and body) by doing >> Mechanize.new.get(uri1).uri, but again, I''m looking to make just a header >> request. >> >> Thanks. >> >> _______________________________________________ >> Mechanize-users mailing list >> Mechanize-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/mechanize-users >> > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/mechanize-users/attachments/20120430/c596c12f/attachment-0001.html>
Thanks. I didn''t realize that there were methods in correspondence with the http verbs. Message: 7 Date: Mon, 30 Apr 2012 08:32:17 -0600 From: Matt White <mattw922 at gmail.com> To: Ruby Mechanize Users List <mechanize-users at rubyforge.org>Subject: Re: [Mechanize-users] way to get response headers only? Message-ID: <CA+BUVh0UXgkEObUSc6CW8Qpdkz8WnfMjHLXJk=ONwQgVhT1qtA at mail.gmail.com> Content-Type: text/plain; charset="iso-8859-1" Just use .head instead of .gethttps:// www.goldstar.com/shows/555643/checkout/new On Mon, Apr 30, 2012 at 8:21 AM, shig odani <sodani at gmail.com> wrote:> Hello, I''m interested in grabbing the final uri of a given uri after any > redirects without retrieving the response body of this final uri. For > example, if uri1 redirects to uri2, which in turn redirects to uri3, I''d > like to just grab the response header of uri3. > > I know that I can get the full response (header and body) by doing > Mechanize.new.get(uri1).uri, but again, I''m looking to make just a header > request. > > Thanks.-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/mechanize-users/attachments/20120430/4def040e/attachment.html>