Przeglądaj źródła

aiohttp context: A 204 no content response should not have content type header

Bastien Sevajol 6 lat temu
rodzic
commit
5b70aedda4
1 zmienionych plików z 4 dodań i 0 usunięć
  1. 4 0
      hapic/ext/aiohttp/context.py

+ 4 - 0
hapic/ext/aiohttp/context.py Wyświetl plik

@@ -107,6 +107,10 @@ class AiohttpContext(BaseContext):
107 107
         http_code: int,
108 108
         mimetype: str = 'application/json',
109 109
     ) -> typing.Any:
110
+        # A 204 no content response should not have content type header
111
+        if http_code == HTTPStatus.NO_CONTENT:
112
+            mimetype = None,
113
+
110 114
         return Response(
111 115
             body=response,
112 116
             status=http_code,