Deprecate body_bytes to merge into body (#1739)
Co-authored-by: Adam Hopkins <admhpkns@gmail.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import asyncio
|
||||
import inspect
|
||||
import os
|
||||
import warnings
|
||||
|
||||
from collections import namedtuple
|
||||
from mimetypes import guess_type
|
||||
@@ -607,3 +608,17 @@ def test_empty_response(app):
|
||||
request, response = app.test_client.get("/test")
|
||||
assert response.content_type is None
|
||||
assert response.body == b""
|
||||
|
||||
|
||||
def test_response_body_bytes_deprecated(app):
|
||||
with warnings.catch_warnings(record=True) as w:
|
||||
warnings.simplefilter("always")
|
||||
|
||||
HTTPResponse(body_bytes=b'bytes')
|
||||
|
||||
assert len(w) == 1
|
||||
assert issubclass(w[0].category, DeprecationWarning)
|
||||
assert (
|
||||
"Parameter `body_bytes` is deprecated, use `body` instead"
|
||||
in str(w[0].message)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user