Skip to content

Commit

Permalink
Parse broth API response properly
Browse files Browse the repository at this point in the history
  • Loading branch information
fasterthanlime committed Aug 28, 2020
1 parent bc4b3ba commit 8649ddb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/broth/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ export class Package implements PackageLike {
throw new Error(`got HTTP ${res.statusCode} while fetching (${url})`);
}

const versionsRes = res.body as VersionsRes;
const versionsRes = JSON.parse(res.body) as VersionsRes;
if (!versionsRes.versions) {
throw new Error(
`got invalid response from broth server: expected JSON object with 'broth' field, got: ${JSON.stringify(
`got invalid response from broth server: expected JSON object with 'versions' field, got: ${JSON.stringify(
versionsRes
)}`
);
Expand Down

0 comments on commit 8649ddb

Please sign in to comment.