chore(contrib): Mitmproxy 9 has removed the HTTP prefix from the Response type

This commit is contained in:
Damir Jelić 2022-11-17 12:29:33 +01:00
parent 02165f7a05
commit 1f2cdfc601
1 changed files with 3 additions and 3 deletions

View File

@ -30,13 +30,13 @@ def timeout(flow):
# hold a tuple containing a function that may or may not create a failure and
# the probability weight at which rate this failure should be triggered.
#
# The method should return an http.HTTPResponse if it should modify the
# The method should return an http.Response if it should modify the
# response or None if the response should be passed as is.
FAILURES = {
"Success": (lambda x: None, 50),
"Gateway error":
(lambda _: http.HTTPResponse.make(500, b"Gateway error"), 20),
"Limit exeeded": (lambda _: http.HTTPResponse.make(
(lambda _: http.Response.make(500, b"Gateway error"), 20),
"Limit exeeded": (lambda _: http.Response.make(
429,
json.dumps({
"errcode": "M_LIMIT_EXCEEDED",