Skip to content

Commit 0014e72

Browse files
author
Paul Diepold
committed
get_token before checking for X-Inertia header
1 parent e521b32 commit 0014e72

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

inertia/middleware.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ def __init__(self, get_response):
1010
def __call__(self, request):
1111
response = self.get_response(request)
1212

13-
if not self.is_inertia_request(request):
14-
return response
15-
1613
# Inertia requests don't ever render templates, so they skip the typical Django
1714
# CSRF path. We'll manually add a CSRF token for every request here.
1815
get_token(request)
1916

17+
if not self.is_inertia_request(request):
18+
return response
19+
2020
if self.is_non_post_redirect(request, response):
2121
response.status_code = 303
2222

0 commit comments

Comments
 (0)