mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #32470 -- Fixed ResolverMatch instance on test clients when request.urlconf is set.
This commit is contained in:
committed by
Mariusz Felisiak
parent
fb93363c49
commit
d6572ee4b0
@@ -725,7 +725,10 @@ class Client(ClientMixin, RequestFactory):
|
||||
response.context = data.get('context')
|
||||
response.json = partial(self._parse_json, response)
|
||||
# Attach the ResolverMatch instance to the response.
|
||||
response.resolver_match = SimpleLazyObject(lambda: resolve(request['PATH_INFO']))
|
||||
urlconf = getattr(response.wsgi_request, 'urlconf', None)
|
||||
response.resolver_match = SimpleLazyObject(
|
||||
lambda: resolve(request['PATH_INFO'], urlconf=urlconf),
|
||||
)
|
||||
# Flatten a single context. Not really necessary anymore thanks to the
|
||||
# __getattr__ flattening in ContextList, but has some edge case
|
||||
# backwards compatibility implications.
|
||||
@@ -914,7 +917,10 @@ class AsyncClient(ClientMixin, AsyncRequestFactory):
|
||||
response.context = data.get('context')
|
||||
response.json = partial(self._parse_json, response)
|
||||
# Attach the ResolverMatch instance to the response.
|
||||
response.resolver_match = SimpleLazyObject(lambda: resolve(request['path']))
|
||||
urlconf = getattr(response.asgi_request, 'urlconf', None)
|
||||
response.resolver_match = SimpleLazyObject(
|
||||
lambda: resolve(request['path'], urlconf=urlconf),
|
||||
)
|
||||
# Flatten a single context. Not really necessary anymore thanks to the
|
||||
# __getattr__ flattening in ContextList, but has some edge case
|
||||
# backwards compatibility implications.
|
||||
|
||||
Reference in New Issue
Block a user