Skip to content

Commit

Permalink
fix(1961): Response does not need to be JSON parsed (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
tkyi authored Sep 7, 2021
1 parent 2dd1fc7 commit d61b302
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1037,9 +1037,7 @@ class BitbucketScm extends Scm {
}

const response = await this.breaker.runCommand(params);

// we will have to parse the body since we are sending a normal FORM POST request
const body = JSON.parse(response.body);
const { body } = response;

if (response.statusCode !== 200) {
throw new Error(`STATUS CODE ${response.statusCode}: ${JSON.stringify(body)}`);
Expand Down
2 changes: 1 addition & 1 deletion test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2213,7 +2213,7 @@ describe('index', function() {
beforeEach(() => {
const response = {
statusCode: 200,
body: JSON.stringify(testPayloadAccessToken)
body: testPayloadAccessToken
};

requestMock.resolves(response);
Expand Down

0 comments on commit d61b302

Please sign in to comment.