Browse Source

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

Bastien Sevajol 6 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
         http_code: int,
107
         http_code: int,
108
         mimetype: str = 'application/json',
108
         mimetype: str = 'application/json',
109
     ) -> typing.Any:
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
         return Response(
114
         return Response(
111
             body=response,
115
             body=response,
112
             status=http_code,
116
             status=http_code,