You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
bazarr/libs/waitress/tests/fixtureapps/error.py

22 lines
653 B

def app(environ, start_response): # pragma: no cover
cl = environ.get("CONTENT_LENGTH", None)
if cl is not None:
cl = int(cl)
body = environ["wsgi.input"].read(cl)
cl = str(len(body))
if environ["PATH_INFO"] == "/before_start_response":
raise ValueError("wrong")
write = start_response(
"200 OK", [("Content-Length", cl), ("Content-Type", "text/plain")]
)
if environ["PATH_INFO"] == "/after_write_cb":
write("abc")
if environ["PATH_INFO"] == "/in_generator":
def foo():
yield "abc"
raise ValueError
return foo()
raise ValueError("wrong")