mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-26 02:40:05 +08:00
bugfix: check HTTP method before request
This commit is contained in:
@@ -156,6 +156,14 @@ class Runner(object):
|
||||
except KeyError:
|
||||
raise exceptions.ParamsError("URL or METHOD missed!")
|
||||
|
||||
# TODO: move method validation to json schema
|
||||
valid_methods = ["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]
|
||||
if method.upper() not in valid_methods:
|
||||
err_msg = u"ParamsError: invalid HTTP method! => {}\n".format(method)
|
||||
err_msg += "available HTTP methods: {}".format("/".join(valid_methods))
|
||||
logger.log_error(err_msg)
|
||||
raise exceptions.ParamsError(err_msg)
|
||||
|
||||
logger.log_info("{method} {url}".format(method=method, url=url))
|
||||
logger.log_debug("request kwargs(raw): {kwargs}".format(kwargs=parsed_request))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user