diff --git a/monkey/monkey_island/cc/ui/src/components/IslandHttpClient.tsx b/monkey/monkey_island/cc/ui/src/components/IslandHttpClient.tsx index 842fa6333..1c9571011 100644 --- a/monkey/monkey_island/cc/ui/src/components/IslandHttpClient.tsx +++ b/monkey/monkey_island/cc/ui/src/components/IslandHttpClient.tsx @@ -13,18 +13,22 @@ export class Response{ class IslandHttpClient extends AuthComponent { post(endpoint: string, contents: any): Promise{ + let status = null; return this.authFetch(endpoint, { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(contents) }) - .then(res => new Response(res.json(), res.status)); + .then(res => {status = res.status; return res.json()}) + .then(res => new Response(res, status)); } get(endpoint: string): Promise{ + let status = null; return this.authFetch(endpoint) - .then(res => new Response(res.json(), res.status)); + .then(res => {status = res.status; return res.json()}) + .then(res => new Response(res, status)); } }