Skip to content

Commit d61b302

Browse files
authored
fix(1961): Response does not need to be JSON parsed (#80)
1 parent 2dd1fc7 commit d61b302

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,9 +1037,7 @@ class BitbucketScm extends Scm {
10371037
}
10381038

10391039
const response = await this.breaker.runCommand(params);
1040-
1041-
// we will have to parse the body since we are sending a normal FORM POST request
1042-
const body = JSON.parse(response.body);
1040+
const { body } = response;
10431041

10441042
if (response.statusCode !== 200) {
10451043
throw new Error(`STATUS CODE ${response.statusCode}: ${JSON.stringify(body)}`);

test/index.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2213,7 +2213,7 @@ describe('index', function() {
22132213
beforeEach(() => {
22142214
const response = {
22152215
statusCode: 200,
2216-
body: JSON.stringify(testPayloadAccessToken)
2216+
body: testPayloadAccessToken
22172217
};
22182218

22192219
requestMock.resolves(response);

0 commit comments

Comments
 (0)