Skip to content

Commit

Permalink
perform method check before using it
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikhail Sobolev committed Jan 22, 2015
1 parent 1a7b2c1 commit a872645
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions master/buildbot/steps/http.py
Expand Up @@ -72,14 +72,16 @@ class HTTPStep(BuildStep):
def __init__(self, url, method, **kwargs):
if txrequests is None or requests is None:
config.error("Need to install txrequest to use this step:\n\n pip install txrequests")

if method not in ('POST', 'GET', 'PUT', 'DELETE', 'HEAD', 'OPTIONS'):
config.error("Wrong method given: '%s' is not known" % method)

self.method = method
self.url = url
self.requestkwargs = {'method': method, 'url': url}
for p in HTTPStep.requestsParams:
v = kwargs.pop(p, None)
self.__dict__[p] = v
if method not in ('POST', 'GET', 'PUT', 'DELETE', 'HEAD', 'OPTIONS'):
config.error("Wrong method given: '%s' is not known" % method)

BuildStep.__init__(self, **kwargs)

Expand Down

0 comments on commit a872645

Please sign in to comment.