Skip to content

Instantly share code, notes, and snippets.

@kern
Created June 11, 2010 01:41
Show Gist options
  • Save kern/433920 to your computer and use it in GitHub Desktop.
Save kern/433920 to your computer and use it in GitHub Desktop.
# Let's assume that google has a Location header like the following: (It does)
# Location: http://www.google.com/
# Let's create a new Response using RestClient.
response = Webbed::Response.new(RestClient.get 'http://google.com')
# Now, we can do this:
response.location # => "http://www.google.com/"
# Let's follow that URL.
response2 = Webbed::Responsenew(RestClient.get response.location)
# This resource doesn't return a Location header
response2.location # => nil
# However, it does have a cache header:
response2.cache_directive # => :private
response2.publicly_cacheable? # => false
response2.privately_cacheable? # => true
response2.max_age # => 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment