Browse Source

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

Bastien Sevajol 5 years ago
parent
commit
5b70aedda4
1 changed files with 4 additions and 0 deletions
  1. 4 0
      hapic/ext/aiohttp/context.py

+ 4 - 0
hapic/ext/aiohttp/context.py View File

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