Created
June 11, 2010 01:41
-
-
Save kern/433920 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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