File tree Expand file tree Collapse file tree 4 files changed +16
-0
lines changed Expand file tree Collapse file tree 4 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,11 @@ def decorator(func):
81
81
@wraps (func )
82
82
def inner (request , * args , ** kwargs ):
83
83
props = func (request , * args , ** kwargs )
84
+
85
+ # if something other than a dict is returned, the user probably wants to return a specific response
86
+ if not isinstance (props , dict ):
87
+ return props
88
+
84
89
return render (request , component , props )
85
90
86
91
return inner
Original file line number Diff line number Diff line change @@ -66,6 +66,12 @@ def test_proper_status_code(self):
66
66
200
67
67
)
68
68
69
+ def test_redirects_from_inertia_views (self ):
70
+ self .assertEqual (
71
+ self .inertia .get ('/inertia-redirect/' ).status_code ,
72
+ 302
73
+ )
74
+
69
75
class LazyPropsTestCase (InertiaTestCase ):
70
76
def test_lazy_props_are_not_included (self ):
71
77
self .assertJSONResponse (
Original file line number Diff line number Diff line change 10
10
path ('lazy/' , views .lazy_test ),
11
11
path ('complex-props/' , views .complex_props_test ),
12
12
path ('share/' , views .share_test ),
13
+ path ('inertia-redirect/' , views .inertia_redirect_test ),
13
14
]
Original file line number Diff line number Diff line change @@ -23,6 +23,10 @@ def empty_test(request):
23
23
def redirect_test (request ):
24
24
return redirect (empty_test )
25
25
26
+ @inertia ('TestComponent' )
27
+ def inertia_redirect_test (request ):
28
+ return redirect (empty_test )
29
+
26
30
@inertia ('TestComponent' )
27
31
def props_test (request ):
28
32
return {
You can’t perform that action at this time.
0 commit comments