diff --git a/src/utilities/responseHelper.ts b/src/utilities/responseHelper.ts index 6072ee8..825dde2 100644 --- a/src/utilities/responseHelper.ts +++ b/src/utilities/responseHelper.ts @@ -1,4 +1,5 @@ import { BadRequestError, NotFoundError, UnauthorizedError } from './errors'; +import { isArray } from 'lodash'; export class ErrorResponse extends Response { //@ts-ignore @@ -41,9 +42,11 @@ export class OkResponse extends Response { constructor(body?: Model | null) { if (body) { return Response.json( - { - ...body, - }, + isArray(body) + ? body + : { + ...body, + }, { status: 200, headers: {