/movies without pagesize or page gives back the old format.

This commit is contained in:
Leonardo Galli 2017-03-06 18:07:14 +01:00
parent 0d60375a56
commit 665832f0cc
1 changed files with 10 additions and 7 deletions

View File

@ -123,7 +123,13 @@ namespace NzbDrone.Api.REST
Get[ROOT_ROUTE] = options => Get[ROOT_ROUTE] = options =>
{ {
var resource = GetResourcePaged(ReadPagingResourceFromRequest()); var pagingSpec = ReadPagingResourceFromRequest();
if (pagingSpec.Page == 0 && pagingSpec.PageSize == 0)
{
var all = GetResourceAll();
return all.AsResponse();
}
var resource = GetResourcePaged(pagingSpec);
return resource.AsResponse(); return resource.AsResponse();
}; };
} }
@ -214,15 +220,12 @@ namespace NzbDrone.Api.REST
private PagingResource<TResource> ReadPagingResourceFromRequest() private PagingResource<TResource> ReadPagingResourceFromRequest()
{ {
int pageSize; int pageSize;
if (!int.TryParse(Request.Query.PageSize.ToString(), out pageSize)) int.TryParse(Request.Query.PageSize.ToString(), out pageSize);
{ if (pageSize == 0) pageSize = 0;
pageSize = 100000;
}
if (pageSize == 0) pageSize = 10;
int page; int page;
int.TryParse(Request.Query.Page.ToString(), out page); int.TryParse(Request.Query.Page.ToString(), out page);
if (page == 0) page = 1; if (page == 0) page = 0;
var pagingResource = new PagingResource<TResource> var pagingResource = new PagingResource<TResource>