mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-22 23:30:10 +00:00
fix response
This commit is contained in:
parent
0696fb7d29
commit
d6941e6bdd
@ -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<Array<JSONObject>>(200, [{ welcome: 'here' }]);
|
||||
expect(responseObjectArray.statusCode).toBe(200);
|
||||
expect(responseObjectArray.data).toEqual([{ welcome: 'here' }]);
|
||||
});
|
||||
});
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user