Explorar el Código

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

Bastien Sevajol hace 6 años
padre
commit
5b70aedda4
Se han modificado 1 ficheros con 4 adiciones y 0 borrados
  1. 4 0
      hapic/ext/aiohttp/context.py

+ 4 - 0
hapic/ext/aiohttp/context.py Ver fichero

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