@@ -33,7 +33,7 @@ public async Task<bool> HandleJsonApiRouteAsync(HttpContext context, IServicePro
33
33
if ( route == null ) return false ;
34
34
35
35
InitializeContext ( context , route ) ;
36
- await CallController ( ) ;
36
+ await CallController ( context ) ;
37
37
38
38
return true ;
39
39
}
@@ -44,15 +44,15 @@ private void InitializeContext(HttpContext context, Route route)
44
44
_jsonApiContext = new JsonApiContext ( context , route , dbContext , _jsonApiModelConfiguration ) ;
45
45
}
46
46
47
- private async Task CallController ( )
47
+ private async Task CallController ( HttpContext context )
48
48
{
49
49
var controller = _controllerBuilder . BuildController ( _jsonApiContext ) ;
50
50
51
51
var result = ActivateControllerMethod ( controller ) ;
52
52
53
53
result . Value = SerializeResult ( result . Value ) ;
54
54
55
- await SendResponse ( result ) ;
55
+ await SendResponse ( context , result ) ;
56
56
}
57
57
58
58
private ObjectResult ActivateControllerMethod ( IJsonApiController controller )
@@ -78,9 +78,8 @@ private object SerializeResult(object result)
78
78
return result == null ? null : new JsonApiSerializer ( _jsonApiContext ) . ToJsonApiDocument ( result ) ;
79
79
}
80
80
81
- private async Task SendResponse ( ObjectResult result )
81
+ private async Task SendResponse ( HttpContext context , ObjectResult result )
82
82
{
83
- var context = _jsonApiContext . HttpContext ;
84
83
context . Response . StatusCode = result . StatusCode ?? 500 ;
85
84
context . Response . ContentType = "application/vnd.api+json" ;
86
85
await context . Response . WriteAsync ( result . Value == null ? "" : result . Value . ToString ( ) , Encoding . UTF8 ) ;
0 commit comments