Просмотр исходного кода

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

Bastien Sevajol 5 лет назад
Родитель
Сommit
5b70aedda4
1 измененных файлов: 4 добавлений и 0 удалений
  1. 4 0
      hapic/ext/aiohttp/context.py

+ 4 - 0
hapic/ext/aiohttp/context.py Просмотреть файл

@@ -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,