﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
33716	Async-capable middleware is not async-capable	abetkin	nobody	"All the standard django middleware is marked as async-capable. As I understand that means that sync_to_async adapters will not be used if no other middleware is present.

However, if you call an endpoint that is handled by an async view, somehow the adapters are still used, and middleware is executed in a separate thread.

Moreover, if you add your custom middleware that is async_capable than it tries not to use adapters, and quickly fails:

[[https://code.djangoproject.com/attachment/ticket/33716/bug.png]]

{{{
AttributeError: 'coroutine' object has no attribute 'get'
}}}

In this example this was XFrameOptionsMiddleware that failed

Github project illustrating this: https://github.com/pwtail/django_bug

Is reproduced in thae main branch and in 4.0
"	Bug	new	Uncategorized	4.0	Release blocker				Accepted	0	0	0	0	0	0
