Skip to content

Instantly share code, notes, and snippets.

@natritmeyer
Created November 1, 2011 12:07
Show Gist options
  • Save natritmeyer/1330393 to your computer and use it in GitHub Desktop.
Save natritmeyer/1330393 to your computer and use it in GitHub Desktop.
HTTP Purge, for use with Varnish
require 'rest-client'
class Net::HTTP::Purge < Net::HTTPRequest
METHOD = 'PURGE'
REQUEST_HAS_BODY = false
RESPONSE_HAS_BODY = true
end
module RestClient
def self.purge(url, headers={}, &block)
Request.execute(:method => :purge, :url => url, :headers => headers, &block)
end
end
#allows:
RestClient.purge "http://www.example.com/purge_me_please"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment