Permalink
Browse files

Adding custom verb example

  • Loading branch information...
augustl committed May 10, 2011
1 parent 1ac7e60 commit c6c3566b7b7171cf968fff87ae84bc54f6468ce4
Showing with 13 additions and 0 deletions.
  1. +13 −0 custom_verb.rb
View
@@ -0,0 +1,13 @@
+require "net/http"
+
+# Varnish uses a custom PURGE verb. A simple subclass is all it takes for
+# Net::HTTP to send requests with this method.
+
+class Purge < Net::HTTPRequest
+ METHOD = "PURGE"
+ REQUEST_HAS_BODY = false
+ RESPONSE_HAS_BODY = false
+end
+
+http = Net::HTTP.new("localhost", "80")
+response = http.request(Purge.new("/"))

0 comments on commit c6c3566

Please sign in to comment.