From b2aa2dee00c60d48a5b62eb4df5e927dd17500be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivo=20Pisa=C5=99ovic?= Date: Tue, 4 Jan 2022 20:38:38 +0100 Subject: [PATCH] Update aiohttp_telemetry_middleware.py Fix: some requests may not have content-type header. --- .../applicationinsights/aiohttp/aiohttp_telemetry_middleware.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/botbuilder-integration-applicationinsights-aiohttp/botbuilder/integration/applicationinsights/aiohttp/aiohttp_telemetry_middleware.py b/libraries/botbuilder-integration-applicationinsights-aiohttp/botbuilder/integration/applicationinsights/aiohttp/aiohttp_telemetry_middleware.py index 30615f5c2..1a83612e6 100644 --- a/libraries/botbuilder-integration-applicationinsights-aiohttp/botbuilder/integration/applicationinsights/aiohttp/aiohttp_telemetry_middleware.py +++ b/libraries/botbuilder-integration-applicationinsights-aiohttp/botbuilder/integration/applicationinsights/aiohttp/aiohttp_telemetry_middleware.py @@ -19,7 +19,7 @@ def retrieve_aiohttp_body(): @middleware async def bot_telemetry_middleware(request, handler): """Process the incoming Flask request.""" - if "application/json" in request.headers["Content-Type"]: + if "Content-Type" in request.headers and request.headers["Content-Type"] == "application/json": body = await request.json() _REQUEST_BODIES[current_thread().ident] = body