Fixed an issue with how responses were handled making arrays into objects.
This commit is contained in:
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user