Skip to content

Commit

Permalink
fix(sanic/tests): replace usage of response.stream (#3887)
Browse files Browse the repository at this point in the history
This function was removed in sanic [v22.6.0](sanic-org/sanic#2487).

We can just use ResponseStream directly.

(cherry picked from commit 9a2febf)
  • Loading branch information
Kyle-Verhoog authored and mergify[bot] committed Jul 1, 2022
1 parent 5e6413e commit e5fbfb8
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tests/contrib/sanic/test_sanic.py
Expand Up @@ -8,7 +8,6 @@
from sanic.config import DEFAULT_CONFIG
from sanic.exceptions import ServerError
from sanic.response import json
from sanic.response import stream
from sanic.response import text
from sanic.server import HttpProtocol

Expand All @@ -27,6 +26,18 @@
sanic_version = tuple(map(int, sanic_version.split(".")))


try:
from sanic.response import ResponseStream

def stream(*args, **kwargs):
return ResponseStream(*args, **kwargs)


except ImportError:
# stream was removed in sanic v22.6.0
from sanic.response import stream


def _response_status(response):
return getattr(response, "status_code", getattr(response, "status", None))

Expand Down

0 comments on commit e5fbfb8

Please sign in to comment.