From 1d694af98e71ce5769da039a89dc7f8e7536ca44 Mon Sep 17 00:00:00 2001 From: ta264 Date: Wed, 1 Dec 2021 21:23:22 +0000 Subject: [PATCH] Workaround .net error serializing new object() See https://github.com/dotnet/runtime/issues/61995 --- src/Readarr.Api.V1/Author/AuthorEditorController.cs | 2 +- src/Readarr.Api.V1/Blocklist/BlocklistController.cs | 2 +- src/Readarr.Api.V1/History/HistoryController.cs | 2 +- src/Readarr.Api.V1/ProviderControllerBase.cs | 3 ++- src/Readarr.Api.V1/Queue/QueueActionController.cs | 4 ++-- src/Readarr.Api.V1/Queue/QueueController.cs | 2 +- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Readarr.Api.V1/Author/AuthorEditorController.cs b/src/Readarr.Api.V1/Author/AuthorEditorController.cs index f1180da10..febaf64ad 100644 --- a/src/Readarr.Api.V1/Author/AuthorEditorController.cs +++ b/src/Readarr.Api.V1/Author/AuthorEditorController.cs @@ -94,7 +94,7 @@ public object DeleteAuthor([FromBody] AuthorEditorResource resource) _authorService.DeleteAuthor(authorId, false); } - return new object(); + return new { }; } } } diff --git a/src/Readarr.Api.V1/Blocklist/BlocklistController.cs b/src/Readarr.Api.V1/Blocklist/BlocklistController.cs index e82390280..683a159c1 100644 --- a/src/Readarr.Api.V1/Blocklist/BlocklistController.cs +++ b/src/Readarr.Api.V1/Blocklist/BlocklistController.cs @@ -37,7 +37,7 @@ public object Remove([FromBody] BlocklistBulkResource resource) { _blocklistService.Delete(resource.Ids); - return new object(); + return new { }; } } } diff --git a/src/Readarr.Api.V1/History/HistoryController.cs b/src/Readarr.Api.V1/History/HistoryController.cs index bb20066eb..a183ee875 100644 --- a/src/Readarr.Api.V1/History/HistoryController.cs +++ b/src/Readarr.Api.V1/History/HistoryController.cs @@ -103,7 +103,7 @@ public List GetAuthorHistory(int authorId, int? bookId = null, public object MarkAsFailed([FromBody] int id) { _failedDownloadService.MarkAsFailed(id); - return new object(); + return new { }; } } } diff --git a/src/Readarr.Api.V1/ProviderControllerBase.cs b/src/Readarr.Api.V1/ProviderControllerBase.cs index 812a290c8..eb21ab030 100644 --- a/src/Readarr.Api.V1/ProviderControllerBase.cs +++ b/src/Readarr.Api.V1/ProviderControllerBase.cs @@ -102,9 +102,10 @@ private TProviderDefinition GetDefinition(TProviderResource providerResource, bo } [RestDeleteById] - public void DeleteProvider(int id) + public object DeleteProvider(int id) { _providerFactory.Delete(id); + return new { }; } [HttpGet("schema")] diff --git a/src/Readarr.Api.V1/Queue/QueueActionController.cs b/src/Readarr.Api.V1/Queue/QueueActionController.cs index ab8c9b4d1..df7edf62a 100644 --- a/src/Readarr.Api.V1/Queue/QueueActionController.cs +++ b/src/Readarr.Api.V1/Queue/QueueActionController.cs @@ -31,7 +31,7 @@ public object Grab(int id) _downloadService.DownloadReport(pendingRelease.RemoteBook); - return new object(); + return new { }; } [HttpPost("grab/bulk")] @@ -49,7 +49,7 @@ public object Grab([FromBody] QueueBulkResource resource) _downloadService.DownloadReport(pendingRelease.RemoteBook); } - return new object(); + return new { }; } } } diff --git a/src/Readarr.Api.V1/Queue/QueueController.cs b/src/Readarr.Api.V1/Queue/QueueController.cs index a6a1444e6..87e7d750a 100644 --- a/src/Readarr.Api.V1/Queue/QueueController.cs +++ b/src/Readarr.Api.V1/Queue/QueueController.cs @@ -86,7 +86,7 @@ public object RemoveMany([FromBody] QueueBulkResource resource, [FromQuery] bool _trackedDownloadService.StopTracking(trackedDownloadIds); - return new object(); + return new { }; } [HttpGet]