Skip to content

Commit 16dcf63

Browse files
committed
Stop test_docker hanging
1 parent f6a1661 commit 16dcf63

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

src/mock_vws/_flask_server/vwq.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,16 @@ def set_terminate_wsgi_input() -> None:
8282
``requests``, so that requests have the given ``Content-Length`` headers
8383
and the given data in ``request.headers`` and ``request.data``.
8484
85-
We set this to ``False`` when running an application as standalone.
85+
We do not set this at all when running an application as standalone.
8686
This is because when running the Flask application, if this is set,
8787
reading ``request.data`` hangs.
8888
8989
Therefore, when running the real Flask application, the behavior is not the
9090
same as the real Vuforia.
9191
This is documented as a difference in the documentation for this package.
9292
"""
93-
terminate_wsgi_input = CLOUDRECO_FLASK_APP.config.get(
94-
"TERMINATE_WSGI_INPUT",
95-
False,
96-
)
97-
request.environ["wsgi.input_terminated"] = terminate_wsgi_input
93+
if CLOUDRECO_FLASK_APP.config.get("TERMINATE_WSGI_INPUT") is True:
94+
request.environ["wsgi.input_terminated"] = True
9895

9996

10097
@CLOUDRECO_FLASK_APP.errorhandler(ValidatorException)

src/mock_vws/_flask_server/vws.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,19 +96,16 @@ def set_terminate_wsgi_input() -> None:
9696
``requests``, so that requests have the given ``Content-Length`` headers
9797
and the given data in ``request.headers`` and ``request.data``.
9898
99-
We set this to ``False`` when running an application as standalone.
99+
We do not set this at all when running an application as standalone.
100100
This is because when running the Flask application, if this is set,
101101
reading ``request.data`` hangs.
102102
103103
Therefore, when running the real Flask application, the behavior is not the
104104
same as the real Vuforia.
105105
This is documented as a difference in the documentation for this package.
106106
"""
107-
terminate_wsgi_input = VWS_FLASK_APP.config.get(
108-
"TERMINATE_WSGI_INPUT",
109-
False,
110-
)
111-
request.environ["wsgi.input_terminated"] = terminate_wsgi_input
107+
if VWS_FLASK_APP.config.get("TERMINATE_WSGI_INPUT") is True:
108+
request.environ["wsgi.input_terminated"] = True
112109

113110

114111
@VWS_FLASK_APP.before_request

0 commit comments

Comments
 (0)