Skip to content

Commit

Permalink
fix(lobby): Prevent error accessing fetch response twice (#1005)
Browse files Browse the repository at this point in the history
  • Loading branch information
RGBKnights authored Sep 8, 2021
1 parent 6c2331b commit ca94f3a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/lobby/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ describe('LobbyClient', () => {
(global as any).fetch = jest.fn(async () => ({
ok: false,
status: 404,
json: async () => ({ moreInformation: 'some helpful details' }),
clone: () => ({
json: async () => ({ moreInformation: 'some helpful details' }),
}),
}));

await expect(client.listGames()).rejects.toThrow(
Expand Down
2 changes: 1 addition & 1 deletion src/lobby/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class LobbyClient {
let details: any;

try {
details = await response.json();
details = await response.clone().json();
} catch {
try {
details = await response.text();
Expand Down

0 comments on commit ca94f3a

Please sign in to comment.