Skip to content
Snippets Groups Projects
Commit f15162f5 authored by Kristof De Langhe's avatar Kristof De Langhe
Browse files

59415: Prevent empty pages returning error, initialize empty array instead

parent 2f58128f
Branches
Tags
No related merge requests found
......@@ -27,7 +27,13 @@ export class DSOResponseParsingService extends BaseResponseParsingService implem
}
parse(request: RestRequest, data: DSpaceRESTV2Response): RestResponse {
const processRequestDTO = this.process<NormalizedObject,ResourceType>(data.payload, request.href);
let processRequestDTO;
// Prevent empty pages returning an error, initialize empty array instead.
if (hasValue(data.payload) && hasValue(data.payload.page) && data.payload.page.totalElements === 0) {
processRequestDTO = { page: [] };
} else {
processRequestDTO = this.process<NormalizedObject, ResourceType>(data.payload, request.href);
}
let objectList = processRequestDTO;
if (hasNoValue(processRequestDTO)) {
return new DSOSuccessResponse([], data.statusCode, undefined)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment