File tree 1 file changed +7
-4
lines changed
1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -42,20 +42,23 @@ public async Task ExecuteResultAsync(ActionContext context)
42
42
version = Guid . NewGuid ( ) . ToString ( ) . Replace ( "-" , string . Empty )
43
43
} ;
44
44
45
+ string dataString = JsonSerializer . Serialize < InertiaData > ( data ) ;
46
+
45
47
if ( context . HttpContext . Request . Headers . ContainsKey ( "X-Inertia" ) )
46
48
{
47
49
if ( context . HttpContext . Request . Headers [ "X-Inertia" ] . ToString ( ) == "true" )
48
50
{
49
51
context . HttpContext . Response . Headers [ "Vary" ] = "Accept" ;
50
52
context . HttpContext . Response . Headers [ "X-Inertia" ] = "True" ;
51
- await new JsonResult ( data ) . ExecuteResultAsync ( context ) ;
53
+ await new ContentResult { Content = dataString , ContentType = "application/json" }
54
+ . ExecuteResultAsync ( context ) ;
52
55
return ;
53
56
}
54
57
}
58
+
59
+ _viewData [ "Data" ] = dataString ;
55
60
56
- _viewData [ "Data" ] = JsonSerializer . Serialize < InertiaData > ( data ) ;
57
-
58
- var render = new ViewResult
61
+ ViewResult render = new ViewResult
59
62
{
60
63
ViewName = "inertia" ,
61
64
ViewData = _viewData ,
You can’t perform that action at this time.
0 commit comments