Skip to content

Commit

Permalink
Remove trailing slash when request goes to other_asgi_app
Browse files Browse the repository at this point in the history
  • Loading branch information
imcarlosguerrero committed Aug 4, 2024
1 parent eb739f7 commit 5904c4b
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/engineio/async_drivers/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,17 @@ async def __call__(self, scope, receive, send):
scope['path'] += '/'
if self.engineio_path is None or scope['path'].startswith(self.engineio_path):
await self.engineio_server.handle_request(scope, receive, send)
else:
static_file = get_static_file(scope['path'], self.static_files) \
if scope['type'] == 'http' and self.static_files else None
if static_file and os.path.exists(static_file['filename']):
await self.serve_static_file(static_file, receive, send)
elif self.other_asgi_app is not None:
await self.other_asgi_app(scope, receive, send)
else:
await self.not_found(receive, send)
if scope['path'].endswith('/'):
scope['path'] = scope['path'][:-1]
static_file = get_static_file(scope['path'], self.static_files) \
if scope['type'] == 'http' and self.static_files else None
if static_file and os.path.exists(static_file['filename']):
await self.serve_static_file(static_file, receive, send)
elif self.other_asgi_app is not None:
await self.other_asgi_app(scope, receive, send)
else:
await self.not_found(receive, send)

async def serve_static_file(self, static_file, receive,
send): # pragma: no cover
Expand Down

0 comments on commit 5904c4b

Please sign in to comment.