Merge branch 'main' into zhiwei/bp-copy
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
from crypt import methods
|
||||
|
||||
from sanic import text
|
||||
from sanic import Sanic, text
|
||||
from sanic.constants import HTTP_METHODS, HTTPMethod
|
||||
|
||||
|
||||
@@ -14,7 +12,7 @@ def test_string_compat():
|
||||
assert HTTPMethod.GET.upper() == "GET"
|
||||
|
||||
|
||||
def test_use_in_routes(app):
|
||||
def test_use_in_routes(app: Sanic):
|
||||
@app.route("/", methods=[HTTPMethod.GET, HTTPMethod.POST])
|
||||
def handler(_):
|
||||
return text("It works")
|
||||
|
||||
@@ -224,7 +224,6 @@ def non_chunked_streaming_app(app):
|
||||
sample_streaming_fn,
|
||||
headers={"Content-Length": "7"},
|
||||
content_type="text/csv",
|
||||
chunked=False,
|
||||
)
|
||||
|
||||
return app
|
||||
@@ -251,11 +250,7 @@ async def test_chunked_streaming_returns_correct_content_asgi(streaming_app):
|
||||
|
||||
|
||||
def test_non_chunked_streaming_adds_correct_headers(non_chunked_streaming_app):
|
||||
with pytest.warns(UserWarning) as record:
|
||||
request, response = non_chunked_streaming_app.test_client.get("/")
|
||||
|
||||
assert len(record) == 1
|
||||
assert "removed in v21.6" in record[0].message.args[0]
|
||||
request, response = non_chunked_streaming_app.test_client.get("/")
|
||||
|
||||
assert "Transfer-Encoding" not in response.headers
|
||||
assert response.headers["Content-Type"] == "text/csv"
|
||||
|
||||
Reference in New Issue
Block a user