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 { BadRequestError, NotFoundError, UnauthorizedError } from './errors';
|
||||||
|
import { isArray } from 'lodash';
|
||||||
|
|
||||||
export class ErrorResponse extends Response {
|
export class ErrorResponse extends Response {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
@@ -41,9 +42,11 @@ export class OkResponse extends Response {
|
|||||||
constructor(body?: Model | null) {
|
constructor(body?: Model | null) {
|
||||||
if (body) {
|
if (body) {
|
||||||
return Response.json(
|
return Response.json(
|
||||||
{
|
isArray(body)
|
||||||
...body,
|
? body
|
||||||
},
|
: {
|
||||||
|
...body,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
status: 200,
|
status: 200,
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
Reference in New Issue
Block a user