Permalink
Browse files

added "HEAD" method to test HTTP services.

  • Loading branch information...
1 parent 729286f commit 78cb50e9628266baeacc962855718deb6399bd9b @brunobord brunobord committed Oct 24, 2011
Showing with 9 additions and 5 deletions.
  1. +9 −5 Sources/watchdog.py
View
14 Sources/watchdog.py
@@ -851,16 +851,20 @@ def run(self):
class HTTP(Rule):
- def __init__(self, GET=None, POST=None, timeout=Time.s(10), freq=Time.m(1), fail=(), success=()):
+ def __init__(self, GET=None, POST=None, HEAD=None, timeout=Time.s(10), freq=Time.m(1), fail=(), success=()):
Rule.__init__(self, freq, fail, success)
url = None
#method = None
if GET:
+ method = "GET"
url = GET
- #method = "GET"
- if POST:
+ elif POST:
+ method = "GET"
url = POST
- #method = "POST"
+ elif HEAD:
+ method = "HEAD"
+ url = HEAD
+
if url.startswith("http://"):
url = url[7:]
server, uri = url.split("/", 1)
@@ -875,7 +879,7 @@ def __init__(self, GET=None, POST=None, timeout=Time.s(10), freq=Time.m(1), fail
self.uri = uri
self.body = ""
self.headers = None
- self.method = "GET"
+ self.method = method
self.timeout = timeout / 1000.0
def run(self):

0 comments on commit 78cb50e

Please sign in to comment.