File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -42,17 +42,18 @@ public async Task WriteAsync(OutputFormatterWriteContext context)
4242 string responseContent ;
4343 try
4444 {
45- if ( context . Object . GetType ( ) == typeof ( Error ) )
45+ if ( context . Object . GetType ( ) == typeof ( Error ) || jsonApiContext . RequestEntity == null )
4646 {
47- logger ? . LogInformation ( "Response was type <Error>. Serializing as plain JSON." ) ;
47+ logger ? . LogInformation ( "Response was not a JSONAPI entity. Serializing as plain JSON." ) ;
48+
4849 responseContent = JsonConvert . SerializeObject ( context . Object ) ;
4950 }
5051 else
5152 responseContent = JsonApiSerializer . Serialize ( context . Object , jsonApiContext ) ;
5253 }
5354 catch ( Exception e )
5455 {
55- logger ? . LogError ( "An error ocurred while formatting the response." , e ) ;
56+ logger ? . LogError ( new EventId ( ) , e , "An error ocurred while formatting the response" ) ;
5657 responseContent = new Error ( "400" , e . Message ) . GetJson ( ) ;
5758 response . StatusCode = 400 ;
5859 }
Original file line number Diff line number Diff line change 11{
2- "version" : " 0.2.5 " ,
2+ "version" : " 0.2.6 " ,
33
44 "dependencies" : {
55 "Microsoft.NETCore.App" : {
You can’t perform that action at this time.
0 commit comments