Skip to content

Commit 72e51bc

Browse files
committed
Make scope attribute access consistent
1 parent d0ba007 commit 72e51bc

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/blueapi/service/middleware.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ async def local_send(message: Message):
3030
message["headers"].append(API_VERSION)
3131
await send(message)
3232

33-
await self.app(scope, receive, local_send)
33+
return await self.app(scope, receive, local_send)
3434

3535

3636
class ObservabilityContextPropagator:
3737
def __init__(self, app: ASGIApp):
3838
self.app = app
3939

4040
async def __call__(self, scope: Scope, receive: Receive, send: Send):
41-
if scope["type"] not in ("http", "websocket"):
41+
if scope.get("type") not in ("http", "websocket"):
4242
return await self.app(scope, receive, send)
4343

4444
ctx = None
@@ -55,4 +55,4 @@ async def __call__(self, scope: Scope, receive: Receive, send: Send):
5555
carrier[ApplicationConfig.VENDOR_CONTEXT_HEADER] = v_ctx
5656
attach(get_global_textmap().extract(carrier))
5757

58-
await self.app(scope, receive, send)
58+
return await self.app(scope, receive, send)

0 commit comments

Comments
 (0)