You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have enabled AcceptHeaderVersioning as the DEFAULT_VERSIONING_CLASS. I have added a custom middleware(added at the last of the MIDDLEWARE list) which looks at request.version value and take actions based on the custom logic. However, I see that request.version is not populated in the middleware and returns the error.
File "/Users/test/opt/miniconda3/envs/test/lib/python3.9/site-packages/django/core/handlers/base.py", line 171, in _get_response
response = middleware_method(request, callback, callback_args, callback_kwargs)
File "/Users/test/work/test1/versioncheck/middleware.py", line 35, in process_view
print(request.version)
AttributeError: 'WSGIRequest' object has no attribute 'version'
Pretty sure this is expected behavior. The middleware stack runs prior to view initialization and the view is actually the entity that carries the versioning class. It is imho expected to be missing on the way down the middleware stack. It should be available on the way up (after view was rendered) though.
I have enabled
AcceptHeaderVersioning
as theDEFAULT_VERSIONING_CLASS
. I have added a custom middleware(added at the last of the MIDDLEWARE list) which looks atrequest.version
value and take actions based on the custom logic. However, I see thatrequest.version
is not populated in the middleware and returns the error.Checklist
The text was updated successfully, but these errors were encountered: