mirror of https://github.com/zulip/zulip.git
middleware: Remove inappropriate StreamingHttpResponse annotation.
Asserting response.stream is False is just suggesting the response being an `HttpResponse`. This removes `StreamingHttpResponse` with the more generic `HttpResponseBase` with an isinstance-check. Signed-off-by: Zixuan James Li <p359101898@gmail.com>
This commit is contained in:
parent
da4654d838
commit
7d86d291d4
|
@ -658,11 +658,10 @@ def alter_content(request: HttpRequest, content: bytes) -> bytes:
|
|||
|
||||
class FinalizeOpenGraphDescription(MiddlewareMixin):
|
||||
def process_response(
|
||||
self, request: HttpRequest, response: StreamingHttpResponse
|
||||
) -> StreamingHttpResponse:
|
||||
|
||||
self, request: HttpRequest, response: HttpResponseBase
|
||||
) -> HttpResponseBase:
|
||||
if RequestNotes.get_notes(request).placeholder_open_graph_description is not None:
|
||||
assert not response.streaming
|
||||
assert isinstance(response, HttpResponse)
|
||||
response.content = alter_content(request, response.content)
|
||||
return response
|
||||
|
||||
|
|
Loading…
Reference in New Issue