diff --git a/Common/Tests/Types/API/Response.test.ts b/Common/Tests/Types/API/Response.test.ts index 2cbdebdcbc..2236d67eb3 100644 --- a/Common/Tests/Types/API/Response.test.ts +++ b/Common/Tests/Types/API/Response.test.ts @@ -7,8 +7,8 @@ describe('Response()', () => { responseObject = new Response(200, { welcome: 'here' }); expect(responseObject.statusCode).toBe(200); expect(responseObject.data).toEqual({ welcome: 'here' }); - responseObject = new Response(200, [{ welcome: 'here' }]); - expect(responseObject.statusCode).toBe(200); - expect(responseObject.data).toEqual([{ welcome: 'here' }]); + let responseObjectArray = new Response>(200, [{ welcome: 'here' }]); + expect(responseObjectArray.statusCode).toBe(200); + expect(responseObjectArray.data).toEqual([{ welcome: 'here' }]); }); }); diff --git a/Common/Types/API/HTTPResponse.ts b/Common/Types/API/HTTPResponse.ts index 9163ad775a..dc657af499 100644 --- a/Common/Types/API/HTTPResponse.ts +++ b/Common/Types/API/HTTPResponse.ts @@ -76,6 +76,8 @@ export default class HTTPResponse< this.jsonData = JSONFunctions.deserializeArray( data['data'] as JSONArray ); + } else if(Array.isArray(data)) { + this.jsonData = JSONFunctions.deserializeArray(data as JSONArray); } else { this.jsonData = JSONFunctions.deserialize(data as JSONObject); }