This repository was archived by the owner on Dec 11, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 4
4
import django
5
5
from django .conf import settings
6
6
from django .test import RequestFactory
7
- from django .http import HttpResponse
7
+ from django .http import HttpResponse , HttpResponseRedirect
8
8
import os
9
9
10
10
settings .configure (
@@ -66,3 +66,19 @@ def test_middleware(self):
66
66
self .set_session (request )
67
67
response = InertiaMiddleware (view )(request )
68
68
self .assertTrue (response .status_code == 200 , response .status_code )
69
+
70
+ def test_redirect_303_for_put_patch_delete_requests (self ):
71
+ request = RequestFactory ().put ("/users/1" )
72
+ self .set_session (request )
73
+ response = InertiaMiddleware (lambda x : HttpResponseRedirect (redirect_to = "/users" ))(request )
74
+ self .assertTrue (response .status_code == 303 , response .status_code )
75
+
76
+ request = RequestFactory ().patch ("/users/1" )
77
+ self .set_session (request )
78
+ response = InertiaMiddleware (lambda x : HttpResponseRedirect (redirect_to = "/users" ))(request )
79
+ self .assertTrue (response .status_code == 303 , response .status_code )
80
+
81
+ request = RequestFactory ().delete ("/users/1" )
82
+ self .set_session (request )
83
+ response = InertiaMiddleware (lambda x : HttpResponseRedirect (redirect_to = "/users" ))(request )
84
+ self .assertTrue (response .status_code == 303 , response .status_code )
You can’t perform that action at this time.
0 commit comments