Skip to content

Commit

Permalink
Fixed Starlette request object missing client.host.
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmorell committed Aug 30, 2024
1 parent 8bd7a84 commit 69d1f3b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions rollbar/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1772,4 +1772,8 @@ def _wsgi_extract_user_ip(environ):


def _starlette_extract_user_ip(request):
if not hasattr(request, 'client'):
return _extract_user_ip_from_headers(request)
if not hasattr(request.client, 'host'):
return _extract_user_ip_from_headers(request)
return request.client.host or _extract_user_ip_from_headers(request)

0 comments on commit 69d1f3b

Please sign in to comment.