File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ def __init__(
54
54
Args:
55
55
background: A background task or a list of background tasks to be executed after the response is sent.
56
56
body: encoded content to send in the response body.
57
+ .. deprecated:: 2.16
57
58
content_length: The response content length.
58
59
cookies: The response cookies.
59
60
encoded_headers: The response headers.
@@ -64,6 +65,16 @@ def __init__(
64
65
media_type: The response media type.
65
66
status_code: The response status code.
66
67
"""
68
+
69
+ if body :
70
+ warn_deprecation (
71
+ version = "2.16" ,
72
+ kind = "parameter" ,
73
+ deprecated_name = "body" ,
74
+ removal_in = "3.0" ,
75
+ info = "'body' passed to a streaming response will be ignored. Streams should always be iterables" ,
76
+ )
77
+
67
78
super ().__init__ (
68
79
background = background ,
69
80
body = body ,
@@ -226,7 +237,6 @@ def to_asgi_response(
226
237
227
238
return ASGIStreamingResponse (
228
239
background = self .background or background ,
229
- body = b"" ,
230
240
content_length = 0 ,
231
241
cookies = cookies ,
232
242
encoded_headers = encoded_headers ,
You can’t perform that action at this time.
0 commit comments