mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-02 20:54:42 +03:00
Set a version attribute on cloned requests if necessary.
This commit is contained in:
parent
6c083b12a1
commit
bf58c1265d
|
@ -86,7 +86,7 @@ def clone_request(request, method):
|
||||||
Internal helper method to clone a request, replacing with a different
|
Internal helper method to clone a request, replacing with a different
|
||||||
HTTP method. Used for checking permissions against other methods.
|
HTTP method. Used for checking permissions against other methods.
|
||||||
"""
|
"""
|
||||||
ret = Request(request=request,
|
ret = Request(request=request._request,
|
||||||
parsers=request.parsers,
|
parsers=request.parsers,
|
||||||
authenticators=request.authenticators,
|
authenticators=request.authenticators,
|
||||||
negotiator=request.negotiator,
|
negotiator=request.negotiator,
|
||||||
|
@ -107,6 +107,8 @@ def clone_request(request, method):
|
||||||
ret.accepted_renderer = request.accepted_renderer
|
ret.accepted_renderer = request.accepted_renderer
|
||||||
if hasattr(request, 'accepted_media_type'):
|
if hasattr(request, 'accepted_media_type'):
|
||||||
ret.accepted_media_type = request.accepted_media_type
|
ret.accepted_media_type = request.accepted_media_type
|
||||||
|
if hasattr(request, 'version'):
|
||||||
|
ret.version = request.version
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user